Async Request
The forvendi.AsyncRequest class builds and configures asynchronous processing requests, execution strategies, payloads, and delayed job parameters using a fluent API.
AsyncRequest(String name, String executionStrategy)
Base constructor for initializing an AsyncRequest.
Signature:
public AsyncRequest(String name, String executionStrategy)Parameters:
name: Process name (Apex class implementingAsyncProcess).executionStrategy: Asynchronous execution strategy type.
getPrototype()
Clones the current request configuration into a new instance.
Signature:
public forvendi.AsyncRequest getPrototype()Return Value: forvendi.AsyncRequest – A cloned copy of the current AsyncRequest.
delayedExecution(Datetime dt)
Schedules the request for delayed execution at a specified date and time.
Signature:
public forvendi.AsyncRequest delayedExecution(Datetime dt)Parameters:
dt: ExecutionDatetimetarget.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
cancelProcess()
Sets a flag indicating that the current AsyncRequest should be canceled.
Signature:
public forvendi.AsyncRequest cancelProcess()Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
withRecords(Set<Id> recordKeys)
Associates a set of record IDs with the current request.
Signature:
public forvendi.AsyncRequest withRecords(Set<Id> recordKeys)Parameters:
recordKeys: Set of record ID values.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
withRecords(Set<String> recordKeys)
Associates a set of record key strings with the current request.
Signature:
public forvendi.AsyncRequest withRecords(Set<String> recordKeys)Parameters:
recordKeys: Set of string key values.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
withRecords(String recordKey)
Associates a single record key with the current request.
Signature:
public forvendi.AsyncRequest withRecords(String recordKey)Parameters:
recordKey: Single record key string or ID.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
withPayload(String payload)
Attaches a contextual payload string to the request.
Signature:
public forvendi.AsyncRequest withPayload(String payload)Parameters:
payload: String payload data.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
withStep(String relatedStepConfigName)
Associates a specific step configuration name with the request.
Signature:
public forvendi.AsyncRequest withStep(String relatedStepConfigName)Parameters:
relatedStepConfigName: Developer name of the step configuration.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
getStepConfigName()
Retrieves the step configuration name associated with the request.
Signature:
public String getStepConfigName()Return Value: String – The associated step configuration developer name.
setQueueEvent(String queueEvent)
Sets the queue event name for Platform Event execution.
Signature:
public forvendi.AsyncRequest setQueueEvent(String queueEvent)Parameters:
queueEvent: Name of the queue event.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
setDelayedQueueObject(String delayedQueueObject)
Sets the delayed queue object developer name.
Signature:
public forvendi.AsyncRequest setDelayedQueueObject(String delayedQueueObject)Parameters:
delayedQueueObject: Target delayed queue object API name.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
withAsyncStrategy(String strategy)
Configures the execution strategy for the asynchronous request.
Signature:
public forvendi.AsyncRequest withAsyncStrategy(String strategy)Parameters:
strategy: Developer name of the execution strategy.
Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
addToQueue()
Enqueues the request into the framework processing queue.
Signature:
public forvendi.AsyncRequest addToQueue()Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
direct()
Configures the request for direct synchronous execution bypassing Platform Events.
Signature:
public forvendi.AsyncRequest direct()Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
addRequestToQueueWithoutJobExecution()
Adds the request to the queue without immediate job execution triggers.
Signature:
public forvendi.AsyncRequest addRequestToQueueWithoutJobExecution()Return Value: forvendi.AsyncRequest – Self-reference for method chaining.
shouldSkipProcessAfterAddingToQueue()
Determines if job execution should halt after queuing.
Signature:
public Boolean shouldSkipProcessAfterAddingToQueue()Return Value: Boolean – true if processing should halt after queuing, false otherwise.
isDirect()
Checks if the request is configured for direct execution.
Signature:
public Boolean isDirect()Return Value: Boolean – true if direct execution is active, false otherwise.
isQueued()
Checks if the request must be stored in the queue before execution.
Signature:
public Boolean isQueued()Return Value: Boolean – true if queued, false otherwise.
isDelayed()
Checks if the request is configured for delayed execution.
Signature:
public Boolean isDelayed()Return Value: Boolean – true if execution is delayed, false otherwise.
getDelayedExecutionTime()
Returns the scheduled date and time for delayed request execution.
Signature:
public Datetime getDelayedExecutionTime()Return Value: Datetime – Target delayed execution timestamp.
isCanceled()
Indicates whether the request has been marked for cancellation.
Signature:
public Boolean isCanceled()Return Value: Boolean – true if canceled, false otherwise.
getName()
Retrieves the developer name of the target process class.
Signature:
public String getName()Return Value: String – Class name implementing AsyncProcess.
getExecutionStrategy()
Retrieves the execution strategy configured for the request.
Signature:
public String getExecutionStrategy()Return Value: String – Strategy developer name.
getPayload()
Retrieves the request payload string.
Signature:
public String getPayload()Return Value: String – Serialized request payload.
getRecordKeys()
Retrieves the set of record keys associated with the request.
Signature:
public Set<String> getRecordKeys()Return Value: Set<String> – Set of record keys.
getQueueObject()
Returns the API name of the queue SObject associated with the request.
Signature:
public String getQueueObject()Return Value: String – Queue object API name.
getQueueEvent()
Returns the API name of the queue event associated with the request.
Signature:
public String getQueueEvent()Return Value: String – Queue event API name.
getDelayedQueueObject()
Returns the API name of the delayed queue SObject.
Signature:
public String getDelayedQueueObject()Return Value: String – Delayed queue object API name.