[SalesForce] how to retreive missed replay ids in platform events

when we publish an event in salesforce , i want to retrieve all the replay ids that are missed/ left without subscription.

I have read in the same site that:

Platform events form an ordered time stream. Each event has a specific "replay ID", and each event's replay ID is higher (not necessarily 1 higher, but higher) than the previous event's.

They're guaranteed to be delivered in a specific order to clients that
are watching the event stream, such as Platform Event triggers and
external subscribers

.

"There is a replay mechanism whereby clients that "missed" part of the stream can supply the last replay ID they received and have all of the event between then and the current moment resent to them for processing (again, in order)."

how can this be acheived?can you please eloborate.

Best Answer

This is outlined, perhaps counter-intuitively, in the Message Durability part of the Streaming API. Basically, while reconnecting, you specify a specific replayId, and all events past that point are replayed back to your client in order. These events are available for 24 hours before being permanently removed.

Related Topic