Why do we need event in batch apex?
The BatchApexErrorEvent event enables a rich set of possibilities for adding more visibility and control over how you handle errors in your Batch Apex jobs. While not yet supported in Beta, the goal is also to support Process Builder and Flow as well, which would then allow admins to configure alerts and notifications.
When was batchapexerrorevent standard platform event introduced?
In Winter’19 the BatchApexErrorEvent standard platform event was introduced (currently in Beta at time of writing). This event extends the above error reporting facilities with the ability to use Platform Events to listen (subscribe) to all job failures in variety of ways using clicks or code (clicks are not supported in Beta).
What does the replay ID mean in batchapexerrorevent?
Represents an ID value that is populated by the system and refers to the position of the event in the event stream. Replay ID values aren’t guaranteed to be contiguous for consecutive events. A subscriber can store a replay ID value and use it on resubscription to retrieve missed events that are within the retention window.
How are platform errors represented in batch job?
Internal platform errors are represented as the System.UnexpectedException type. The Record IDs that are in scope if the event was fired from the execute () method of a batch job. If the batch job uses custom iterators instead of sObjects, JobScope is the toString () representation of the iterable objects.
What does event do in batch retry framework?
This event extends the above error reporting facilities with the ability to use Platform Events to listen (subscribe) to all job failures in variety of ways using clicks or code (clicks are not supported in Beta). The fields on the event give rich access to the exception type, stack trace, affected scope (records) and job ID.
Why do we use batch apex for retry?
The framework uses Batch Apex for retry because it allows for the same level of error handling as the original job (in case of repeat failures) and allows for greater scope and limits than for example trying retry scopes in a synchronous Apex context.