Code Monkey home page Code Monkey logo

streaming-sfdx's Introduction

plugin-streaming

npm version

Streaming API and push topic management.

Usage

Install like this:

sfdx plugins:install @mshanemc/plugin-streaming

Command inventory:

$ sfdx streaming --help

Commands

sfdx streaming:list [-t <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

What kinds of things can I subscribe to?

USAGE
  $ sfdx streaming:list [-t <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -t, --types=types                                                                 [default: cdc,event,topic] optional
                                                                                    specify which types to query

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx shane:streaming:list

EXAMPLES
  sfdx streaming:list // list everything
  sfdx streaming:list -t cdc,topic // list CDC and PushTopic but not standard and custom PlatformEvents

See code: src/commands/streaming/list.ts

sfdx streaming:pushtopic:create -n <string> -q <string> [-d <integer>] [-f <string>] [-o <array>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Create push topics

USAGE
  $ sfdx streaming:pushtopic:create -n <string> -q <string> [-d <integer>] [-f <string>] [-o <array>] [-u <string>]
  [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --description=description                                                     add a description to the push topic

  -f, --notifyforfields=All|Referenced|Select|Where                                 [default: Referenced] Specifies
                                                                                    which fields are evaluated to
                                                                                    generate a notification

  -n, --name=name                                                                   (required) name for the push topic

  -o, --operations=operations                                                       [default:
                                                                                    create,update,delete,undelete] which
                                                                                    operations should produce a
                                                                                    notification

  -q, --query=query                                                                 (required) The SOQL query statement
                                                                                    that determines which record changes
                                                                                    trigger events to be sent to the
                                                                                    channel.

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx shane:streaming:pushtopic:create

EXAMPLES
  sfdx streaming:pushtopic:create -n myTopic -q "select Id,Name from account"
       // creates the push topic

  sfdx streaming:pushtopic:create -n myTopic -q "select Id from account" -f All -o create,update
       // creates the push topic and sets operations and watches all fields

See code: src/commands/streaming/pushtopic/create.ts

sfdx streaming:pushtopic:deactivate -n <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

deactivate push topics

USAGE
  $ sfdx streaming:pushtopic:deactivate -n <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -n, --name=name                                                                   (required) name for the push topic

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx shane:streaming:pushtopic:deactivate

EXAMPLE
  sfdx streaming:pushtopic:deactivate -n myTopic

See code: src/commands/streaming/pushtopic/deactivate.ts

sfdx streaming:pushtopic:delete -n <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Delete a push topic

USAGE
  $ sfdx streaming:pushtopic:delete -n <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -n, --name=name                                                                   (required) name for the push topic

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx shane:streaming:pushtopic:delete

EXAMPLE
  sfdx streaming:pushtopic:delete -n myTopic

See code: src/commands/streaming/pushtopic/delete.ts

sfdx streaming:pushtopic:update -n <string> [-d <integer>] [-f <string>] [-o <array>] [-q <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

Update push topics

USAGE
  $ sfdx streaming:pushtopic:update -n <string> [-d <integer>] [-f <string>] [-o <array>] [-q <string>] [-u <string>]
  [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --description=description                                                     add a description to the push topic

  -f, --notifyforfields=All|Referenced|Select|Where                                 Specifies which fields are evaluated
                                                                                    to generate a notification

  -n, --name=name                                                                   (required) name for the push topic

  -o, --operations=operations                                                       which operations should produce a
                                                                                    notification

  -q, --query=query                                                                 The SOQL query statement that
                                                                                    determines which record changes
                                                                                    trigger events to be sent to the
                                                                                    channel.

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx shane:streaming:pushtopic:update

EXAMPLES
  sfdx streaming:pushtopic:update -n myTopic -q "select Id,Name from account"
       // modifies the push topic

  sfdx streaming:pushtopic:update -n myTopic -q "select Id from account" -f All -o create,update
       // modifies the push topic and sets operations and watches all fields

See code: src/commands/streaming/pushtopic/update.ts

sfdx streaming:subscribe [-t <string>] [-n <string>] [-r <integer>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

USAGE
  $ sfdx streaming:subscribe [-t <string>] [-n <string>] [-r <integer>] [-u <string>] [--apiversion <string>] [--json]
  [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -n, --name=name                                                                   name of the topic/event/dataEvent

  -r, --replay=replay                                                               [default: -1] replay Id to begin
                                                                                    from

  -t, --type=event|topic|cdc                                                        [default: event] the type of thing
                                                                                    you want to subscribe to

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx shane:streaming:subscribe

EXAMPLES
  sfdx streaming:subscribe -t cdc -n ChangeEvents   // subscribe to all CDC
  sfdx streaming:subscribe -t cdc -n AccountChangeEvent   // subscribe to cdc for a standard object
  sfdx streaming:subscribe -t event -n Something__e   // subscribe to platform event
  sfdx streaming:subscribe -t event -n Something__e -r 6744   // subscribe to platform event with a replay ID
  sfdx streaming:subscribe -t topic -n myTopic   // subscribe to a push topic

See code: src/commands/streaming/subscribe.ts

streaming-sfdx's People

Contributors

mshanemc avatar

Stargazers

 avatar

Watchers

 avatar  avatar

streaming-sfdx's Issues

Error running streaming:subscribe: "Socket timeout occured while listening for results"

Hi,
Thank you for providing this really useful plugin! I use it with great success. One thing that currently is a bit of a pain is that the sfdx streaming:subscribe command is working only for ca. 1min and then errors out with the error message:
ERROR running streaming:subscribe: Socket timeout occurred while listening for results.

This is happening:

sfdx streaming:subscribe -u <..> -t event -n LoginEventStream
Listening on /event/LoginEventStream... (ctrl-c to exit)
ERROR running streaming:subscribe: Socket timeout occured while listening for results.

Same happens as well if LoginEvents are received after the streaming:subscribe command is started.

It would be great if the streaming:subscribe command could work longer than a minute. This seems to be possible as the Streaming Monitor (https://github.com/pozil/streaming-monitor) does not show this behaviour.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.