Qorus Integration Engine®  5.1.2_git
OMQ::UserApi::Workflow::QorusAsyncStep Class Referenceabstract

The abstract class for asynchronous steps. More...

Inheritance diagram for OMQ::UserApi::Workflow::QorusAsyncStep:
OMQ::UserApi::Workflow::QorusAsyncStepBase OMQ::UserApi::Workflow::QorusStepBase

Public Member Methods

abstract public nothing primary ()
 The primary step logic for the async step. More...
string validation (*string async_key)
 Validation logic for the step. More...
nothing end (auto queue_data)
 This method is run when the queue data bound to the asynchronous is updated and receives status OMQ::QS_Received. More...

Additional Inherited Members

- Static Public Member Methods inherited from OMQ::UserApi::Workflow::QorusAsyncStepBase
static public submitAsyncKey (string key)
 Binds the given key to the asynchronous step. More...
static public skipAsyncStep ()
 This method will skip the execution of an asynchronous step. More...

Detailed Description

The abstract class for asynchronous steps.

An asynchronous step should be used any time a workflow action should be executed and it's not known in advance how long the action could take, or if the action should take a long period of time.

class MyAsyncStepClass inherits QorusAsyncStep {
primary() {
# ... primary step logic
string validation(*string key) {
# call checkAction() to check in the target DB if the action has completed
if (checkAction(key)) {
return OMQ::StatComplete;
# call checkPending() to see if we retry or still wait
return checkPending(key) ? OMQ::StatAsyncWaiting : OMQ::StatRetry;
end(hash<auto> data) {
# the error thrown here should be defined by the workflow's errorfunction
if (data.status == "ERROR") {
} else {
log(LoggerLevel::INFO, "data status: %y", data.status);
bool checkAction(string key) {
# ... logic here
bool checkPending(string key) {
# ... logic here
Qorus step constructors do not take any arguments; see Step Constructors and Static Initialization for information about constructors and static class initialization.
See also
Asynchronous Steps

Member Function Documentation

◆ end()

nothing OMQ::UserApi::Workflow::QorusAsyncStep::end ( auto  queue_data)

This method is run when the queue data bound to the asynchronous is updated and receives status OMQ::QS_Received.

The job of this method is to determine if the asynchronously-received data is correct or not; if it is not correct, then the function should raise an error by calling wf_serror() or by throwing an appropriate exception. If no validation of the data is required, then the function body may be empty.

queue_dataany data that was posted when the queue status got status OMQ::QS_Received
the implementation of the logic in this base class is empty; it must be overridden in child classes to react to the async queue data

◆ primary()

abstract public nothing OMQ::UserApi::Workflow::QorusAsyncStep::primary ( )
pure virtual

The primary step logic for the async step.

This code must call either submitAsyncKey() or skipAsyncStep() or an error will be raised.

If the step is not to be skipped, then the step nust start the asynchronous action and save a unique key for the action by calling the submitAsyncKey() workflow API function.

◆ validation()

string OMQ::UserApi::Workflow::QorusAsyncStep::validation ( *string  async_key)

Validation logic for the step.

This method must be overridden for steps that can only execute once; by default this method will return OMQ::StatRetry, meaning that the primary step logic will be repeated.

async_keythe asynchronous key for the step, if bound, if not, this value will be NOTHING
this must be one of the following step status constants:
  • StatComplete: do not run the primary step logic; mark the step as "COMPLETE" and continue. For asynchronous steps, the back-end logic (end()) will not be run in this case
  • StatError: do not run the primary step logic; mark the step as "ERROR" and stop running any further dependencies of this step
  • StatRetry: run the step function again immediately. If the step is an asynchronous step with queue data with a OMQ::QS_Waiting status, the queue data will be deleted immediately before the step function is run again
  • StatAsyncWaiting: for asynchronous steps only, do not run the step function and keep the "ASYNC-WAITING" status. For non-asynchronous steps, raises an error and the return value is treated like OMQ::StatError
if any other value than the above is returned, an error is raised and the return value is treated like OMQ::StatError
See also

The documentation for this class was generated from the following file:
deprecated log(softint lvl, softstring msg)
Writes the information passed to the workflow, service, job, or system log file depending on the call...