@gdnsl/plugin-streams
TypeScript icon, indicating that this package has built-in type declarations

0.0.55 • Public • Published

@gdnsl/plugin-streams

gdnsl plugin for stream commands

Usage

$ npm install -g @gdnsl/plugin-streams
$ @gdnsl/plugin-streams COMMAND
running command...
$ @gdnsl/plugin-streams (--version)
@gdnsl/plugin-streams/0.0.55 darwin-x64 node-v14.20.0
$ @gdnsl/plugin-streams --help [COMMAND]
USAGE
  $ @gdnsl/plugin-streams COMMAND
...

Commands

@gdnsl/plugin-streams help [COMMAND]

Display help for @gdnsl/plugin-streams.

USAGE
  $ @gdnsl/plugin-streams help [COMMAND] [-n]

ARGUMENTS
  COMMAND  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for @gdnsl/plugin-streams.

See code: @oclif/plugin-help

@gdnsl/plugin-streams stream-worker STREAMAPPNAME

Publish/Unpublish a stream worker.

USAGE
  $ @gdnsl/plugin-streams stream-worker [STREAMAPPNAME] [-h] [-c <value>] [--fabric <value>] [--query <value> |
    --enable | --disable]

ARGUMENTS
  STREAMAPPNAME  Name of the stream worker app

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to publish/unpublish a stream worker.
  --disable             Deactivate the stream app.
  --enable              Activate the stream app.
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --query=<value>       submit an ad hoc Stream query and get the result records from a store.

DESCRIPTION
  Publish/Unpublish a stream worker.

EXAMPLES
  
    # Publish a stream worker.
      gdnsl stream-worker TestStreamWorker --enable
    # Unpublish a stream worker.
      gdnsl stream-worker TestStreamWorker --disable
    # Submit an ad hoc Stream query and get the result records from a store.
      gdnsl stream-worker TestStream --query "SELECT * FROM TestStreamTable"

See code: dist/commands/stream-worker/index.ts

@gdnsl/plugin-streams stream-worker create

Create a stream worker.

USAGE
  $ @gdnsl/plugin-streams stream-worker create [-h] [-c <value>] [--fabric <value>] [--advanced <value> | --name <value> |
    --description <value> | --source <value> | --sink <value> | --table <value> | --store <value> | --trigger <value> |
    --query <value> | --unique-index <value> | --file <value> | --index <value> | --js-function <value>] [--regions
    <value>] [--validate]

FLAGS
  -c, --config=<value>       gdnsl config file (default is ./gdnsl.yaml).
  -h, --help                 Help to create a stream worker.
  --advanced=<value>         complete stream worker definiton as string
  --description=<value>      stream worker description.
  --fabric=<value>           Name of the fabric. Default will be "_system"
  --file=<value>             json file from where the stream worker definition is to be read from
  --index=<value>...         index definition. Can be provided multiple times.
  --js-function=<value>...   JS function definition. Can be provided multiple times.
  --name=<value>             stream worker name.
  --query=<value>...         stream query. Can be provided multiple times.
  --regions=<value>          comma separated regions where stream workers should be deployed. Default to local region.
  --sink=<value>...          sink definition. Can be provided multiple times.
  --source=<value>...        source definition. Can be provided multiple times.
  --store=<value>...         store definition. Can be provided multiple times.
  --table=<value>...         table definition. Can be provided multiple times.
  --trigger=<value>          trigger definition. Can be provided only once.
  --unique-index=<value>...  unique index definition. Can be provided multiple times.
  --validate                 validate stream worker definition. Stream worker will not be created.

DESCRIPTION
  Create a stream worker.

EXAMPLES
    # Create a simple stream worker.
     gdnsl stream-worker create 
        --name "cargo-stream-worker" 
        --description "my stream worker" 
        --source "SampleCargoAppInputTable WITH 
                  (type = 'database', collection = 'SampleCargoAppInputTable', collection.type='doc' , replication.type='global', map.type='json') (weight int);"
        --sink "STREAM SampleCargoAppDestStream (weight int);"
        --query "INSERT INTO SampleCargoAppDestStream 
                 SELECT weight 
                 FROM SampleCargoAppInputTable;"
    # Create a stream worker using JS functions.
     gdnsl stream-worker create 
        --name "abc-stream-worker" 
        --description "my stream worker2" 
        --function "concatFn[javascript] return string {
                        var str1 = data[0];
                        var str2 = data[1];
                        var str3 = data[2];
                        var response = str1 + str2 + str3;
                        return response;
                    };"
        --source "STREAM SampleScriptAppInputStream (deviceID string, roomNo int, temperature double);"
        --table "SampleScriptAppOutputTable (id string, temperature double);"
        --query "INSERT INTO SampleScriptAppOutputTable 
                  SELECT concatFn(roomNo,'-',deviceID) as id, temperature
                  FROM SampleScriptAppInputStream;"
    # Create a cron stream worker.
     gdnsl stream-worker create 
        --name "cron-stream-worker" 
        --description "This app will produce an event after every 5 secondsr" 
        --trigger "MyTrigger WITH ( interval = 5 sec );"
        --sink "STREAM SampleStream (startTime long);"
        --table "SampleScriptAppOutputTable (id string, temperature double);"
        --query "INSERT INTO SampleStream
                  SELECT eventTimestamp() as startTime
                  FROM MyTrigger;"
    # Create a stream worker with indexes.
     gdnsl stream-worker create 
        --name "my-stream-worker2" 
        --description "This application creates different types of indexes on a given table." 
        --table "SampleGDNTable (sensorId string, temperature double);"
        --index "SamplePersistentIndex ON TABLE SampleGDNTable WITH(type='persistent', sparse='true', deduplicate='true') (sensorId);"
        --index "SampleHashIndex ON TABLE SampleGDNTable WITH(type='hash', sparse='true', deduplicate='true') (sensorId);"
        --index "SampleFullTextIndex ON TABLE SampleGDNTable WITH(type='fulltext', minLength='3') (sensorId);"
        --index "SampleGeoIndex ON TABLE SampleGDNTable WITH(type='geo', geoJson='false') (sensorId);"
        --index "SampleTTLIndex ON TABLE SampleGDNTable WITH(type='ttl', expireAfter='3600') (sensorId);"
    # Validate a stream worker.
     gdnsl stream-worker create 
        --name "cargo-stream-worker" 
        --description "my stream worker" 
        --source "SampleCargoAppInputTable WITH 
                  (type = 'database', collection = "SampleCargoAppInputTable", collection.type="doc" , replication.type="global", map.type='json') (weight int);"
        --sink "STREAM SampleCargoAppDestStream (weight int);"
        --query "INSERT INTO SampleCargoAppDestStream 
                 SELECT weight 
                 FROM SampleCargoAppInputTable;"
        --validate
     # Validate a stream worker from a file.
     gdnsl stream-worker create --file "cargo-stream-worker.json" --validate
    # Create a stream worker with indexes.
     gdnsl stream-worker create 
        --name "my-rdbmc-cdc" 
        --description "This stream app will explain the usage of rdbms store extension using MySQL database" 
        --trigger "ceprdbmsTrigger WITH (interval=5 sec);"
        --store " StockTable WITH 
                  ( type="rdbms", 
                    jdbc.url="jdbc:mysql://dummy-mysql-server.com:3306/MySQLDB?useSSL=false", 
                    username="my-username", 
                    password="my-password", 
                    jdbc.driver.name="com.mysql.jdbc.Driver",
                    field.length="symbol:100", 
                    table.check.query="SELECT 1 FROM StockTable LIMIT", 
                    PrimaryKey='id', 
                    PrimaryKey='symbol', 
                    Index='volume') 
                    (id string, symbol string, price float, volume long);"
        --query " INSERT INTO StockTable
                  SELECT convert(count(), 'string')  as id, 
                        convert(count(), 'string') as symbol, 
                        23.33f as price, 
                        eventTimestamp() as volume 
                  FROM ceprdbmsTrigger; "
     # Create a stream worker from a file.
     gdnsl stream-worker create -file "cargo-stream-worker.json" --regions "gdn-us-west,gdn-ap-west"

@gdnsl/plugin-streams stream-worker delete STREAMAPPNAME

Delete a stream worker.

USAGE
  $ @gdnsl/plugin-streams stream-worker delete [STREAMAPPNAME] [-h] [-c <value>] [--fabric <value>]

ARGUMENTS
  STREAMAPPNAME  Name of the stream worker app

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to delete a stream worker.
  --fabric=<value>      Name of the fabric. Default will be "_system"

DESCRIPTION
  Delete a stream worker.

EXAMPLES
    # Delete a stream worker.
      gdnsl stream-worker delete TestStreamWorker

@gdnsl/plugin-streams stream-worker describe STREAMAPPNAME

Describe a stream worker.

USAGE
  $ @gdnsl/plugin-streams stream-worker describe [STREAMAPPNAME] [-h] [-c <value>] [--fabric <value>]

ARGUMENTS
  STREAMAPPNAME  Name of the stream worker app.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to describe a stream worker.
  --fabric=<value>      Name of the fabric. Default will be "_system"

DESCRIPTION
  Describe a stream worker.

EXAMPLES
    # Describe a stream worker.
      gdnsl stream-worker describe TestStreamWorker

@gdnsl/plugin-streams stream-worker list

List stream workers and sample stream workers.

USAGE
  $ @gdnsl/plugin-streams stream-worker list [-h] [-c <value>] [--fabric <value>] [--sample] [-o json]

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help list stream workers and sample stream workers.
  -o, --output=(json)   Output format. Only json is allowed
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --sample              gdnsl config file (default is ./gdnsl.yaml).

DESCRIPTION
  List stream workers and sample stream workers.

EXAMPLES
  
    # List stream workers.
      gdnsl stream-worker list
    # List sample stream workers.
      gdnsl stream-worker list --sample

@gdnsl/plugin-streams stream-worker update

Update a stream worker.

USAGE
  $ @gdnsl/plugin-streams stream-worker update --name <value> [-h] [-c <value>] [--fabric <value>] [--advanced <value> |
    --description <value> | --source <value> | --sink <value> | --table <value> | --store <value> | --trigger <value> |
    --query <value> | --unique-index <value> | --file <value> | --index <value> | --js-function <value>] [--regions
    <value>] [--validate]

FLAGS
  -c, --config=<value>       gdnsl config file (default is ./gdnsl.yaml).
  -h, --help                 Help to create a stream worker.
  --advanced=<value>         complete stream worker definiton as string
  --description=<value>      stream worker description. Mandatory field.
  --fabric=<value>           Name of the fabric. Default will be "_system"
  --file=<value>             json file from where the stream worker definition is to be read from
  --index=<value>...         index definition. Can be provided multiple times.
  --js-function=<value>...   JS function definition. Can be provided multiple times.
  --name=<value>             (required) stream worker name. Mandatory field.
  --query=<value>...         stream query. Can be provided multiple times.
  --regions=<value>          comma separated regions where stream workers should be deployed. Default to local region.
  --sink=<value>...          sink definition. Can be provided multiple times.
  --source=<value>...        source definition. Can be provided multiple times.
  --store=<value>...         store definition. Can be provided multiple times.
  --table=<value>...         table definition. Can be provided multiple times.
  --trigger=<value>          trigger definition. Can be provided only once.
  --unique-index=<value>...  unique index definition. Can be provided multiple times.
  --validate                 validate stream worker definition. Stream worker will not be updated.

DESCRIPTION
  Update a stream worker.

EXAMPLES
    # Update a simple stream worker.
     gdnsl stream-worker update 
        --name "cargo-stream-worker" 
        --description "my stream worker" 
        --source "SampleCargoAppInputTable WITH 
                  (type = 'database', collection = "SampleCargoAppInputTable", collection.type="doc" , replication.type="global", map.type='json') (weight int);"
        --sink "STREAM SampleCargoAppDestStream (weight int);"
        --query "INSERT INTO SampleCargoAppDestStream 
                 SELECT weight 
                 FROM SampleCargoAppInputTable;"
    # Update a stream worker using JS functions.
     gdnsl stream-worker update 
        --name "abc-stream-worker" 
        --description "my stream worker2" 
        --function "concatFn[javascript] return string {
                        var str1 = data[0];
                        var str2 = data[1];
                        var str3 = data[2];
                        var response = str1 + str2 + str3;
                        return response;
                    };"
        --source "STREAM SampleScriptAppInputStream (deviceID string, roomNo int, temperature double);"
        --table "SampleScriptAppOutputTable (id string, temperature double);"
        --query "INSERT INTO SampleScriptAppOutputTable 
                  SELECT concatFn(roomNo,'-',deviceID) as id, temperature
                  FROM SampleScriptAppInputStream;"
    # Update a cron stream worker.
     gdnsl stream-worker update 
        --name "cron-stream-worker" 
        --description "This app will produce an event after every 5 secondsr" 
        --trigger "MyTrigger WITH ( interval = 5 sec );"
        --sink "STREAM SampleStream (startTime long);"
        --table "SampleScriptAppOutputTable (id string, temperature double);"
        --query "INSERT INTO SampleStream
                  SELECT eventTimestamp() as startTime
                  FROM MyTrigger;"
    # Update a stream worker with indexes.
     gdnsl stream-worker update 
        --name "my-stream-worker2" 
        --description "This application creates different types of indexes on a given table." 
        --table "SampleGDNTable (sensorId string, temperature double);"
        --index "SamplePersistentIndex ON TABLE SampleGDNTable WITH(type="persistent", sparse="true", deduplicate="true") (sensorId);"
        --index "SampleHashIndex ON TABLE SampleGDNTable WITH(type="hash", sparse="true", deduplicate="true") (sensorId);"
        --index "SampleFullTextIndex ON TABLE SampleGDNTable WITH(type="fulltext", minLength="3") (sensorId)"
        --index "SampleGeoIndex ON TABLE SampleGDNTable WITH(type="geo", geoJson="false") (sensorId);"
        --index "SampleTTLIndex ON TABLE SampleGDNTable WITH(type="ttl", expireAfter="3600") (sensorId);"
    # Validate a stream worker.
     gdnsl stream-worker update 
        --name "cargo-stream-worker" 
        --description "my stream worker" 
        --source "SampleCargoAppInputTable WITH 
                  (type = 'database', collection = "SampleCargoAppInputTable", collection.type="doc" , replication.type="global", map.type='json') (weight int);"
        --sink "STREAM SampleCargoAppDestStream (weight int);"
        --query "INSERT INTO SampleCargoAppDestStream 
                 SELECT weight 
                 FROM SampleCargoAppInputTable;"
        --validate
     # Validate a stream worker from a file.
     gdnsl stream-worker update -file "cargo-stream-worker.json" --validate
    # Update a stream worker with indexes.
     gdnsl stream-worker update 
        --name "my-rdbmc-cdc" 
        --description "This stream app will explain the usage of rdbms store extension using MySQL database" 
        --trigger "ceprdbmsTrigger WITH (interval=5 sec);"
        --store " StockTable WITH 
                  ( type="rdbms", 
                    jdbc.url="jdbc:mysql://dummy-mysql-server.com:3306/MySQLDB?useSSL=false", 
                    username="my-username", 
                    password="my-password", 
                    jdbc.driver.name="com.mysql.jdbc.Driver",
                    field.length="symbol:100", 
                    table.check.query="SELECT 1 FROM StockTable LIMIT", 
                    PrimaryKey='id', 
                    PrimaryKey='symbol', 
                    Index='volume') 
                    (id string, symbol string, price float, volume long);"
        --query " INSERT INTO StockTable
                  SELECT convert(count(), 'string')  as id, 
                        convert(count(), 'string') as symbol, 
                        23.33f as price, 
                        eventTimestamp() as volume 
                  FROM ceprdbmsTrigger; "
     # Update a stream worker from a file.
     gdnsl stream-worker update --file "cargo-stream-worker.json" --regions "gdn-us-west,gdn-ap-west"

@gdnsl/plugin-streams streams backlog

Delete backlog for all/subscriptions.

USAGE
  $ @gdnsl/plugin-streams streams backlog [-h] [-c <value>] [--fabric <value>] [--delete] [--subscription <value>]

FLAGS
  -c, --config=<value>    gdnsl config file (default is ./gdnsl.yaml).
  -h, --help              Help to delete backlog for all/subscriptions
  --delete                Delete all streams' backlog.
  --fabric=<value>        Name of the fabric. Default will be "_system"
  --subscription=<value>  Delete subscription's backlog.

DESCRIPTION
  Delete backlog for all/subscriptions.

EXAMPLES
    # Clear backlog for all streams
      gdnsl streams backlog --delete
    # Clear subscription’s backlog    
      gdnsl streams backlog --delete --subscription MyTopic

@gdnsl/plugin-streams streams create STREAMNAME

Create a stream.

USAGE
  $ @gdnsl/plugin-streams streams create [STREAMNAME] [-h] [-c <value>] [--fabric <value>] [--global]

ARGUMENTS
  STREAMNAME  Name of the stream.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to create stream
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --global              Is stream global or not.

DESCRIPTION
  Create a stream.

EXAMPLES
   # Create a new stream name testStream of type global.
     gdnsl streams create testStream --global
   # Create a new stream name testStream of type local.
     gdnsl streams create testStream

@gdnsl/plugin-streams streams delete STREAMNAME

Delete a stream.

USAGE
  $ @gdnsl/plugin-streams streams delete [STREAMNAME] [-h] [-c <value>] [--fabric <value>] [--global]

ARGUMENTS
  STREAMNAME  Name of the stream.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to delete a stream
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --global              Is stream global or not.

DESCRIPTION
  Delete a stream.

EXAMPLES
    # Delete a stream of type global
      gdnsl streams delete testStream --global
    # Delete a stream of type local
      gdnsl streams delete c8localstestStream

@gdnsl/plugin-streams streams describe STREAMNAME

Describe stream's backlog, stats and subscriptions.

USAGE
  $ @gdnsl/plugin-streams streams describe [STREAMNAME] [-h] [-c <value>] [--fabric <value>] [--global]
    [--collection-stream] [--backlog] [--stats] [--subscription] [-o json]

ARGUMENTS
  STREAMNAME  Name of the stream.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to describe streams.
  -o, --output=(json)   Output format. Only json is allowed
  --backlog             Get stream's backlog value.
  --collection-stream   Is stream collection stream?
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --global              Is stream global.
  --stats               Get stream's stats value.
  --subscription        Get stream's backlog value.

DESCRIPTION
  Describe stream's backlog, stats and subscriptions.

EXAMPLES
    # Get  stream's backlog  for stream type global
      gdnsl streams describe testStream --backlog --global
    # Get  stream's backlog  for stream type local
      gdnsl streams describe testStream1 --backlog
     # Get  stream's stats  for stream type global
      gdnsl streams describe testStream2 --stats --global
     # Get  stream's stats  for stream type local
      gdnsl streams describe testStream3 --stats
     # Get  stream's subscription  for stream type global
      gdnsl streams describe testStream4 --subscription --global
     # Get  stream's subscription  for stream type local
      gdnsl streams describe testStream5 --subscription

@gdnsl/plugin-streams streams expire STREAMNAME

Expire messages on the stream for all subscriptions.

USAGE
  $ @gdnsl/plugin-streams streams expire [STREAMNAME] --seconds <value> [-h] [-c <value>] [--fabric <value>]
    [--global]

ARGUMENTS
  STREAMNAME  Name of the stream.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to expire messages on the stream for all subscriptions.
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --global              Is stream global or not.
  --seconds=<value>     (required) Expiration value in seconds.

DESCRIPTION
  Expire messages on the stream for all subscriptions.

EXAMPLES
    # Expire messages on the stream for all subscriptions for stream type global
      gdnsl streams expire testStream1 --seconds 9600 --global
  
    # Expire messages on the stream for all subscriptions for stream type local
      gdnsl streams expire testStream2 --seconds 9600

@gdnsl/plugin-streams streams list

List streams.

USAGE
  $ @gdnsl/plugin-streams streams list [-h] [-c <value>] [--fabric <value>] [-o json]

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to list streams.
  -o, --output=(json)   Output format. Only json is allowed
  --fabric=<value>      Name of the fabric. Default will be "_system"

DESCRIPTION
  List streams.

EXAMPLES
    # list streams 
    gdnsl streams list

@gdnsl/plugin-streams streams publish STREAMNAME

Publish a message to a stream.

USAGE
  $ @gdnsl/plugin-streams streams publish [STREAMNAME] --message <value> [-h] [-c <value>] [--global] [--fabric
    <value>]

ARGUMENTS
  STREAMNAME  Name of the stream.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to publish a message to a stream.
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --global              Is stream global or not.
  --message=<value>     (required) Message to be published to the stream.

DESCRIPTION
  Publish a message to a stream.

EXAMPLES
      #Publish message to a stream of type global  
      gdnsl streams publish testStream --message "This is global stream"  --global
  
      #Publish message to a stream of type local
      gdnsl streams publish testStream --message "This is local stream"

@gdnsl/plugin-streams streams subscription SUBNAME

Delete all subscriptions or subscriptions of a particular stream.

USAGE
  $ @gdnsl/plugin-streams streams subscription [SUBNAME] [-h] [-c <value>] [--fabric <value>] [--global] [--delete]
    [--stream <value>]

ARGUMENTS
  SUBNAME  Name of the subscription.

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help for deleting subscriptions
  --delete              Delete the given subscription on all streams
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --global              Is stream global or not.
  --stream=<value>      Name of the streams.

DESCRIPTION
  Delete all subscriptions or subscriptions of a particular stream.

EXAMPLES
    # Delete the given subscription 'mysubscription' for all the streams
    gdnsl streams subscription mysubscription --delete 
    # Delete subscription on a specific stream
    gdnsl streams subscription mysubscription --stream stream1

@gdnsl/plugin-streams streams ttl

Get or set message TTL (time-to-live) in seconds for streams.

USAGE
  $ @gdnsl/plugin-streams streams ttl [-h] [-c <value>] [--fabric <value>] [--seconds <value>] [-o json]

FLAGS
  -c, --config=<value>  gdnsl config file (default is ./gdnsl.yaml).
  -h, --help            Help to get or set streams TTL.
  -o, --output=(json)   Output format. Only json is allowed
  --fabric=<value>      Name of the fabric. Default will be "_system"
  --seconds=<value>     Value in seconds for setting stream's ttl.

DESCRIPTION
  Get or set message TTL (time-to-live) in seconds for streams.

EXAMPLES
      # Get streams TTL
      gdnsl streams ttl 
  
      # Set message TTL for 3600 seconds on all streams
      gdnsl streams ttl --seconds 3600

Package Sidebar

Install

npm i @gdnsl/plugin-streams

Weekly Downloads

1

Version

0.0.55

License

MIT

Unpacked Size

138 kB

Total Files

64

Last publish

Collaborators

  • macrometa