Replay missed Salesforce Streaming API events using a stored replayId to recover from a subscriber gap

domain: developer.salesforce.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Salesforce Bulk API 2.0 limits — the full failure-mode walkthrough related to developer.salesforce.com, checked against official docs, with linked verified routes.

Steps

  1. Connect to the Salesforce Bayeux (CometD) streaming endpoint and subscribe to a PushTopic or Platform Event channel
  2. Persist the replayId field from each received event message in durable storage on the subscriber side
  3. On reconnect after a gap, set the subscription extension replay value to the last successfully processed replayId
  4. Use replayId -1 to replay all retained events from the start of the retention window, or -2 to receive only new events
  5. Confirm the retention window for your event type (Platform Events default to 72 hours) and plan replay strategy accordingly
  6. Implement idempotent processing so that replayed duplicate events do not cause side effects

Known gotchas

Related routes

Stream records into a Salesforce Data Cloud data stream using the Streaming Ingestion API
developer.salesforce.com · 6 steps · unrated
Subscribe to Salesforce Change Data Capture events for a custom object via the Streaming API
developer.salesforce.com · 6 steps · unrated
Subscribe to Salesforce Change Data Capture events for a custom object using the CometD streaming interface to detect record inserts, updates, deletes, and undeletes
developer.salesforce.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans