Module: SalesforceStreamer
- Defined in:
- lib/salesforce_streamer.rb,
lib/salesforce_streamer/cli.rb,
lib/salesforce_streamer/log.rb,
lib/salesforce_streamer/errors.rb,
lib/salesforce_streamer/server.rb,
lib/salesforce_streamer/version.rb,
lib/salesforce_streamer/launcher.rb,
lib/salesforce_streamer/push_topic.rb,
lib/salesforce_streamer/configuration.rb,
lib/salesforce_streamer/salesforce_client.rb,
lib/salesforce_streamer/salesforce_topic_manager.rb,
lib/salesforce_streamer/replay_id_error_extension.rb
Overview
SalesforceStreamer wraps the Restforce Streaming API implementation so that your PushTopics are managed in the same place as your server set up.
Establishing a connection to your Salesforce instances is performed using the Restforce client and your ENV variables.
export SALESFORCE_HOST="test.salesforce.com"
export SALESFORCE_USERNAME="[email protected]"
export SALESFORCE_PASSWORD="password"
export SALESFORCE_SECURITY_TOKEN="security token"
export SALESFORCE_CLIENT_ID="long client id"
export SALESFORCE_CLIENT_SECRET="long client secret"
export SALESFORCE_API_VERSION="41.0"
Define each PushTopic and handler inside of a YAML config file and load it upon starting up the server.
bundle exec streamer -C config/streamer.yml
Starting up the server takes a few moments before accepting new events. First, the server launches the PushTopic manager to upsert each PushTopic defined in the configuration file provided. Once each PushTopic is up to date, then the server launches the event manager to listen for and handle messages.
Turn on verbose logging for troubleshooting. The -r flag will activate the Restforce logger, so this is not recommended for production. The -v flag activates a Logger to STDERR with DEBUG level by default. Set the log level with the -v flag.
bundle exec streamer
bundle exec streamer -C config/streamer.yml -v
bundle exec streamer -C config/streamer.yml -v INFO
bundle exec streamer -C config/streamer.yml -r -v
bundle exec streamer -C config/streamer.yml -r -v INFO
Defined Under Namespace
Classes: CLI, Configuration, Launcher, Log, MissingCLIFlagError, NilQueryError, PushTopic, PushTopicHandlerMissingError, PushTopicNameTooLongError, ReplayIdErrorExtension, SalesforceClient, SalesforceTopicManager, Server, UnprocessableHandlerError
Constant Summary collapse
- ReplayIdError =
Class.new(StandardError)
- VERSION =
'2.12.1'.freeze
Class Method Summary collapse
Class Method Details
.config ⇒ Object
58 59 60 |
# File 'lib/salesforce_streamer.rb', line 58 def self.config Configuration.instance end |
.configure {|Configuration.instance| ... } ⇒ Object
66 67 68 |
# File 'lib/salesforce_streamer.rb', line 66 def self.configure yield Configuration.instance end |
.logger ⇒ Object
62 63 64 |
# File 'lib/salesforce_streamer.rb', line 62 def self.logger config.logger end |