HerokuMars HallExplainer
Reactive Programming with Salesforce Data
Summary
Salesforce Platform Events and Change Data Capture enable custom applications to react to activity in Salesforce, motivating an event-sourced design for responsive, durable integrations. The article demonstrates a Node.js app on Heroku that consumes the Salesforce Streaming API through jsforce 1.9.0 or later, whose Faye-based streaming client handles authentication, network connectivity, and message callbacks. It notes that a basic subscription loses its position on restart and cannot coordinate parallel processing, then uses Redis to persist each topic’s Replay ID and distribute messages through pub/sub or reliable queues. Because the Salesforce Streaming API lacks consumer-group delivery, a singleton stream_consumer feeds Redis while scalable web or worker processes handle work. The design also recommends a separate non-admin integration user and monitoring connection status, active clients, last message time, and processing duration.
Context
Basic Salesforce stream consumption is fragile because it loses its position after server restarts and lacks coordination for parallel processing. The Salesforce Streaming API also does not provide delivery distribution across multiple consumers, while external integrations require monitoring for failures that may appear as inactivity.
Approach / What changed
A Node.js app on Heroku uses jsforce’s Faye-based streaming client to consume Salesforce data. Redis stores each topic’s Replay ID and distributes messages through pub/sub or reliable queues; a singleton stream_consumer receives Salesforce events, while scalable web or worker processes handle them.
Takeaways
jsforce 1.9.0 and later provides Salesforce Streaming API support through a Faye-based client that manages authentication and network connectivity.
Redis makes the stream consumer durable by storing the last consumed Replay ID and supports distribution to parallel processes through pub/sub or reliable queues.
The recommended deployment uses one Salesforce stream_consumer process, separate scalable web or worker processes, a non-admin integration user, and stream-health monitoring.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.