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.

System

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.

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.

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.

public void execute(System.FinalizerContext finalizerContext)

Type: void

For a sample implementation of the System.Finalizer interface, see the Logging Finalizer Example in Transaction Finalizers.