Finalizer Interface
Use this interface to attach actions that are executed at the end of asynchronous
Queueable job executions. A specific use case is to design recovery actions when a Queueable job
fails.
Namespace
Usage
The execute method is called on the provided Finalizer instance for every enqueued job that has an attached finalizer. Within the execute method, you can define the actions to be taken at the end of the Queueable job. An instance of System.FinalizerContext is injected by the Apex runtime engine as an argument to the execute method.
Finalizer Methods
The following are methods for Finalizer.
execute(finalizerContext)
The execute method is called on the provided
Finalizer instance for every enqueued job that has an
attached finalizer. Within the execute method, you can
define the actions to be taken at the end of the Queueable job.
Signature
public void execute(System.FinalizerContext finalizerContext)
Parameters
- finalizerContext
- Type: FinalizerContext Interface
Return Value
Type: void
Finalizer Example Implementation
For a sample implementation of the System.Finalizer interface, see the Logging Finalizer Example in Transaction Finalizers.