I am working with High Volume and Publish After Commit Platform Events and I am trying to understand if there is a way to know which Platform Events have been queued successfully.
We invoke the EventBus.publish(events)
method providing the list of Platform Events we want to publish and we receive a List<Database.SaveResult>
.
Since we are working with High Volume Platform Events, we know that the Database.SaveResult
object gives us only the information regarding the successful or unsuccessful queuing operation for a specific Platform Event: it means even we receive a successful SaveResult, the related Platform Event may not be published later on.
My initial goal was to implement a tracking process for all the Platform Events:
- I create a list of Platform Events I want to publish;
- I invoke the
Eventbus.publish()
method providing the list of Platform Events; - The
Eventbus.publish()
method returns a list ofDatabase.SaveResult
objects. EachDatabase.SaveResult
object contains a reference (or the values itself) to a Platform Event and it gives information regarding the queuing operation (successfully/unsuccessfully).
SaveResult
. EventBus with high-volume platform events is at-most once delivery. If you need at-least once delivery or exactly-once, then choose technology that supports this.