Streamforce
In most cases, consuming events received from the Salesforce Streaming API can be broken down into three very specific steps:
- Connecting to the Salesforce API and listening for messages
 - Ingesting received messages into some sort of internal event bus (e.g. RabbitMQ, Kafka, Redis, etc)
 - Processing the stored messages
 
Streamforce aims to be an abstraction for the first step, by implementing some of the common tasks that need to be performed by any well-behaved client:
- The interactions with the Streaming API need to be logged using the correct severity
(e.g. handshakes should use 
Logger::DEBUGwhile subscription errors should useLogger::ERRORfor better visibility) - Replay IDs need to be stored using a persistent storage like Redis and not in-memory
 
As an alternative, checkout Restforce.
Usage
A very simple client, which automatically connects based on the following environment variables:
SALESFORCE_USERNAMESALESFORCE_PASSWORDSALESFORCE_SECURITY_TOKENSALESFORCE_CLIENT_IDSALESFORCE_CLIENT_SECRETREDIS_URL
require "streamforce"
client = Streamforce::Client.new
subscriptions = %w[
  /topic/account-monitor
  /event/AccountUpdated__e
]
client.subscribe(subscriptions) do |subscription, message|
  # Your code
endContributing
Bug reports and pull requests are welcome on GitHub at https://github.com/andreimaxim/streamforce.
License
The gem is available as open source under the terms of the MIT License.