FinalizerContext Interface
Represents the parameter type of the execute method in a class that implements the Finalizer interface. This interface is implemented internally by Apex. The System.FinalizerContext interface contains four methods: getAsyncApexJobId, getRequestId, getResult, and getException. An instance of System.FinalizerContext is injected by the Apex runtime engine as an argument to the Finalizer.execute method.
The following are methods for FinalizerContext.
-
Returns the ID of the Queueable job for which this finalizer is defined.
-
Returns the exception with which the Queueable job failed when
getResultisUNHANDLED_EXCEPTION, null otherwise. -
Returns the request ID that can be correlated with Event Monitoring logs. To correlate the request with the AsyncApexJob table, use the
getAsyncApexJobIdmethod instead. The Queueable job and the Finalizer execution share the same request ID. -
Returns the
System.ParentJobResultenum, which represents the result of the parent asynchronous Apex Queueable job to which the finalizer is attached. The enum takes these values:SUCCESS,UNHANDLED_EXCEPTION.
Returns the ID of the Queueable job for which this finalizer is defined.
public Id getAsyncApexJobId()
Type: Id
Returns the exception with which the Queueable job failed when getResult is UNHANDLED_EXCEPTION, null otherwise.
public Exception getException()
Type: Exception
Returns the request ID that can be correlated with Event Monitoring logs. To correlate the request with the AsyncApexJob table, use the getAsyncApexJobId method instead. The Queueable job and the Finalizer execution share the same request ID.
public String getRequestId()
Type: String
Returns the System.ParentJobResult enum, which represents the result of the parent asynchronous Apex Queueable job to which the finalizer is attached. The enum takes these values: SUCCESS, UNHANDLED_EXCEPTION.
public System.ParentJobResult getResult()
Type: System.ParentJobResult