1

The LWC Docs describe the replayId parameter in the lightning\empApi subscribe method as follows (emphasis is mine):

Indicates what point in the stream to replay events from. Specify -1 to get new events from the tip of the stream, -2 to replay from the last saved event, or a specific event replay ID to get all saved and new events after that ID.

I would like to replay from the first saved event (i.e. I want to get all the events that are still persisting). Am I out of luck?

Use case: a custom LWC on the Opportunity detail page where users may send related Attachments to an external system. In some cases, due to governor limits around heap and callout size, this process will use a @future method. The @future method will publish events pertaining to the success or failure of the operation. I would like to be able to present information about recent attempts to send files, so users can check on the status even if they navigate away from the page and come back later.

3
  • 1
    What are you trying to achieve? You might find salesforce.stackexchange.com/questions/321807/… helpful
    – identigral
    Commented Nov 19, 2020 at 18:48
  • 3
    You would go with -2 if you want to fetch all the events those still exist on the stream within the retention window.
    – Jayant Das
    Commented Nov 19, 2020 at 18:53
  • Added the use case. Based on the discussion in the thread you linked, it does sound like -2 is what I want, despite the wording in the docs. Thanks! Commented Nov 19, 2020 at 18:54

0

You must log in to answer this question.