module SalesforceStreamer

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="user@domain.tld"
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

Constants

ReplayIdError
VERSION

Public Class Methods

config() click to toggle source
# File lib/salesforce_streamer.rb, line 58
def self.config
  Configuration.instance
end
configure() { |instance| ... } click to toggle source
# File lib/salesforce_streamer.rb, line 62
def self.configure
  yield Configuration.instance
end