Using the class “AsyncProcessFinisher”
You can use the class dvelop_docs_dev.AsyncProcessFinisher to finish an asynchronous queueable process and then respond to the output of the process.
The AsyncProcessFinisher job implements the queueable interface, which you can start using System.enqueueJob().
Signature
global with sharing virtual class AsyncProcessFinisher implements IServiceProcessFinisher
Contents
Constructors
You can create an instance of AsyncProcessFinisher jobs with the following constructors:
AsyncProcessFinisher(defaultParamName)
This creates an AsyncProcessFinisher job with the name of the default parameter that is used to output most asynchronous processes.
Signature
global AsyncProcessFinisher(String defaultParamName)
Parameters
defaultParamName: The name of the default output parameter. This parameter is used by most asynchronous processes to transfer the output of the processes.
Data type: String
Methods
The class AsyncProcessFinisher provides the following methods:
execute(processOutput)
This method executes custom logic after finishing a queueable process. To control the executed logic, overwrite the method in your own implementation.
Signature
protected virtual void execute(Map<String, Object> processOutput)
Parameters
processOutput: A dictionary collection of output values from the previous process.
Data type: Map<string, object>
Default value: new Map<string, object>()
Use
The next chapter shows you some application scenarios depicting the correct use of the class.
Creating a simple finish job
public class CustomFinishJob extends dvelop_docs_dev.AsyncProcessFinisher { private static final String DEFAULT_PARAM_NAME = 'default'; public CustomFinishJob() { super(DEFAULT_PARAM_NAME); } public override void execute(Map<String, Object> processOutput) { System.debug(processOutput); Object defaultOutput = processOutput.get(DEFAULT_PARAM_NAME); System.debug(defaultOutput); } }