Related post on uniqueness of replayIds

Using Workbench to examine metadata for the OOTB field ReplayId on any Platform Event SObject (one that ends in __e) shows:

  • bytelength: 3000
  • length: 1000
  • type: String

Now, evidence shows (and Platform Event documentation and related StreamingAPI documentation) this value to be an integer. Even the JSON example in the StreamingAPI shows it as a number:

    "payload":"This is a message."

Further cementing the evidence that Replayid is an integer, doing a metadata describe on EventBusSubcriber, the fields Tip and Position are both of type int with 9 digit precision. These two fields define the relative points in the stream between last event published versus last event consumed.

So, should I care? Or is an assumption of integers good enough?

Rationale for asking ... I was planning on a solution wherein I backed up incoming platform events to Sobjects by publishing out another platform event (which is guaranteed to publish even if the initial consuming transaction blows up on a Limits exception). Think of this a fallback backup solution.

The backup SObject had a uniquekey defined as the concatenation of the initial xxx__e sobjectType + Replayid. This strategy works fine if replayids are numbers as the unique key will be < 255 chars in length. But if Replayids can be 1000 characters long, I need to rethink things.

Side note ..to date in our org, Replayids have incremented up to about 1,000,000 for the most active xxx__e platform events

1 Answer 1


So, should I care? Or is an assumption of integers good enough?

In my opinion, as long as it's documented to be numeric, I would go ahead and utilize this as number.

While this is still not clear why the describe would show a different result, but in any case if there's a scenario where there seems to be a discrepancy, I would reach out to Salesforce to make sure the implementation based on documentation will not fail.

Thinking it from a different perspective, if I use a Java Client using CometD to subscribe to an Event, I will always pass an numeric replayId instead of a String value to make sure that I successfully retrieve all replay ids after the value that I am passing.

  • 1
    Jayant -- The CometD evidence was pretty convincing to me to stick with current plan; will let this marinate a bit to see what other responses come through.
    – cropredy
    Oct 30, 2018 at 18:33
  • I am still baffled why does the describe on the field show it as string (I verified it myself). Will see if I can reach out to Salesforce support.
    – Jayant Das
    Oct 30, 2018 at 18:45
  • @JayantDas Yes, I'd suggest contacting support. Bugs like this have happened before, and they usually get it fixed.
    – sfdcfox
    Oct 30, 2018 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .