TriggerContext Class
Namespace
TriggerContext Properties
The following are properties for TriggerContext.
lastError
Signature
public String lastError {get;}
Property Value
Type: String
Usage
The error message that this property returns is the message that was passed in when creating the EventBus.RetryableException exception, as follows.
throw new EventBus.RetryableException(
'Condition is not met, so retrying the trigger again.');
retries
Signature
public Integer retries {get;}
Property Value
Type: Integer
TriggerContext Methods
The following are methods for TriggerContext.
currentContext()
getResumeCheckpoint()
Signature
public String getResumeCheckpoint()
Return Value
Type: String
setResumeCheckpoint(resumeReplayId)
Signature
public void setResumeCheckpoint(String resumeReplayId)
Parameters
- resumeReplayId
- Type: String
- The replay ID of the last successfully processed platform event message, after which to resume processing in a new trigger execution context.
Return Value
Type: void
Usage
The method throws an EventBus.InvalidReplayIdException if the supplied Replay ID is not valid—the replay ID is not in the current trigger batch of events, in the Trigger.new list.
Example
This snippet shows how to call the method and pass in the replayId property of an event instance.
EventBus.TriggerContext.currentContext().setResumeCheckpoint(event.replayId);