Qorus Integration Engine® Enterprise Edition 6.0.15_prod
Loading...
Searching...
No Matches
Job API Reference

Introduction to the Qorus Job API

See also

Job Class API

The job class APIs are documented here:

A job's job class must inherit one of:

This means that job code can call static methods defined in the base classes directly.

For library classes and other job code, calls must be prefixed with the class name (also for all Java code as well).

Job Qore Program Container

Each job has a single Qore Program object containing the code to be defined when the job trigger time arrives, as well as any objects imported into the Program object (classes, constants, and functions listed as attributes of the job when the job is defined). Job Program objects are restricted from using elements of the Qore language related to process and thread control; the use of these functions is either dangerous or could violate the integrity of the Qorus server process and therefore is restricted.

To enforce these restrictions, job Program objects are created with the following sandbox flags:

Directive Constant Description
%allow-weak-references Qore::PO_ALLOW_WEAK_REFERENCES the := operator may be used
%no-process-control Qore::PO_NO_PROCESS_CONTROL Functionality that affects the entire process is unavailable
%no-thread-control Qore::PO_NO_THREAD_CONTROL Thread management functionality is unavailable
%no-top-level Qore::PO_NO_TOP_LEVEL_STATEMENTS No code is allowed in the top-level statement (outside a function or class)
%require-our Qore::PO_REQUIRE_OUR All variables must be declared before use

Please note that despite these restrictions, job program objects have most of the Qore language API and class library available for use.

Furthermore, the following parse defines are defined:

Define Availability Description
Qorus W, S, J Identifies code in Qorus
QorusEE W, S, J Identifies the Enterprise Edition of Qorus (QorusCE is defined in the Community Edition)
QorusHasAlerts W, S, J Marks the availability of the alert API (Qorus 3.0+)
QorusHasTableCache W, S, J Marks the availability of the table cache API (Qorus 3.1+)
QorusHasUserConnections W, S, J Marks the availability of the connection API (Qorus 3.0+)
QorusJob S Identifies code used in a job Program container
QorusServer W, S, J Identifies code used in Qorus server interfaces

Each job's Program container is set up with the following imported objects:

In addition to the above, all public constants in the OMQ namespace are available.

Note
All defines set in qorus.defines (common to workflows, services, and jobs) are also set in job Program containers

Job API

The following APIs are imported into job program logic containers (see also JobApi and OMQ::UserApi::Job):

API Method Domain Availability Description
UserApi::auditCheckEventString() Audit W, S, J checks if the given audit event (given as a string) is enabled
UserApi::auditCheckEvent() Audit W, S, J checks if the given audit event (given as an integer code) is enabled
UserApi::auditGetMask() Audit W, S, J returns the audit event mask
UserApi::auditUserEvent() Audit W, S, J creates a user audit event (with audit event code OMQ::AE_USER_EVENT) against the workflow, service, or job instance
UserApi::callNetworkApi() Utility W, S, J calls a system RPC API with system permissions
UserApi::callNetworkApiArgs() Utility W, S, J calls a system RPC API with system permissions with an explicit argument list argument
UserApi::callNetworkApiArgsWithAuthentication() Utility W, S, J calls a system RPC API with authentication information (username and password)
UserApi::callRestApi() Utility W, S, J calls a system REST API with system permissions
UserApi::callRestApiWithAuthentication() Utility W, S, J calls a system REST API with authentication information (username and password)
UserApi::clearSqlTableCache() SQL Cache W, S, J clears a cached table from the SQL cache
UserApi::createOrder() Utility W, S, J creates a workflow order data instance in the database and returns the workflow_instanceid of the order created
UserApi::createRemoteOrder() Utility W, S, J creates a workflow order data instance in a remote Qorus instance and returns the workflow_instanceid of the order created
UserApi::deserializeQorusData() Utility W, S, J deserializes strings to Qore data structures
UserApi::execSynchronousWorkflow() Utility W, S, J executes a workflow order synchronously and returns the result of execution
UserApi::executeFsm() Utility W, S, J executes a finite state machine registered with the interface and returns the result
UserApi::flushSlaEvents() SLA W, S, J flushes all pending SLA events to the DB
UserApi::getActiveJobs() System Info W, S, J returns information about active jobs
JobApi::getConfigItemHash() n/a J retrieves a hash of all job configuration items
JobApi::getConfigItemValue() n/a J retrieves the value of a job configuration item
UserApi::getDatasourceDedicated() Connections W, S, J returns a dedicated Qore::SQL::Datasource object
UserApi::getDatasourcePool() Connections W, S, J returns a shared Qore::SQL::DatasourcePool object
UserApi::getGlobalConfigItemValue() Qorus System Information API W, S, J returns the value of the given configuration item on global level
UserApi::getOption() Options W, S, J returns the value of one or more system or interface options
UserApi::getQorusOptions() Options W, S, J returns the value of system options
UserApi::getQorusOptionsArgs() Options W, S, J returns the value of system options
UserApi::getQorusOptionInfo() Options W, S, J returns information about system options
UserApi::getQorusOptionInfoArgs() Options W, S, J returns information about system options
UserApi::getRemoteRestConnection() Connections W, S, J returns a QorusSystemRestHelper to a remote Qorus instance
UserApi::getRemoteRpcConnection() Connections W, S, J returns a QorusSystemAPIHelper to a remote Qorus instance
UserApi::getRunningWorkflowInfo() System Info W, S, J returns information about a running workflow execution instance
UserApi::getRunningWorkflowList() System Info W, S, J returns information about running workflow execution instances
UserApi::getServiceInfo() System Info W, S, J returns information about a service
UserApi::getSessionId() System Info W, S, J returns the current application session ID
UserApi::getSqlTable() SQL Cache W, S, J retrieves an AbstractTable object from the SQL cache for DML operations
UserApi::getSqlCacheInfo() SQL Cache W, S, J returns information about the SQL cache
UserApi::getSystemInfo() System Info W, S, J returns information about the system
UserApi::getSystemServiceInfo() System Info W, S, J returns information about a system service
UserApi::getUserConnection() Connections W, S, J returns the given user connection object
UserApi::getUserServiceInfo() System Info W, S, J returns information about a user service
UserApi::getValueMap() Value Maps W, S, J retrieves a value mapping from a value map
UserApi::getValueMaps() Value Maps W, S, J retrieves a list of all known value sets
JobApi::err() Job API J raises job errors with mandatory error and description string arguments
JobApi::errWithInfo() Job API J raises job errors
JobApi::getStateData() Job API J retrieves job state data if available
JobApi::getInfo() Job API J retrieves information about the currently-executing job
UserApi::registerFsmAsObserver() Utility W, S, J registers a finite state machine as an event observer
JobApi::saveInfo() Job API J saves information about job processing agaainst the job instance record
JobApi::saveStateData() Job API J saves job state data against the current job instance
JobApi::setTrigger() Job API J sets a custom trigger time for the next job instance
JobApi::warnWithInfo() Job API J raises job warnings
UserApi::logInfo() logging W, S, J outputs a log message in the workflow's log file
UserApi::getNextSequenceValue() Utility W, S, J returns the next value from the given datasource and database sequence
UserApi::sleep() Utility W, S, J safely pause execution for a defined period of time
UserApi::usleep() Utility W, S, J safely pause execution for a defined period of time
UserApi::postSlaEventError() SLA W, S, J posts an unsuccessful event for SLA and performance tracking
UserApi::postSlaEventSuccess() SLA W, S, J posts a successful event for SLA and performance tracking
UserApi::postSyncEvent() Utility W, S, J posts a workflow synchronization event given the event type name and event key
UserApi::postUserEvent() Utility W, S, J posts an application event of class OMQ::QE_CLASS_USER
UserApi::propGet() System Props W, S, J returns the value of the given system property key in the given domain or NOTHING if the system property does not exist
UserApi::propUpdate() System Props W, S, J changes (inserts, updates, or deletes) the value of one or more system properties
UserApi::qorusGetLocalUrl() System Info W, S, J returns a URL for the current system
UserApi::raiseTransientAlert() Alerts W, S, J raises a transient alert
UserApi::restartTransaction() Utility W, S, J enables recovery from restartable DB communication errors
UserApi::runtimeProperties() System Info W, S, J returns information about runtime system defines defined
UserApi::serializeQorusData() Utility W, S, J serializes Qore data structures to strings
UserApi::setOption() Options W, S, J sets option values on a workflow, service, or job

Job API Classes

The following classes are imported into job program logic containers:

Class Availability Description
AbstractFsRemoteReceive W, S, J provides an API for streaming data from a remote filesystem through a remote Qorus instance
AbstractParallelStream W, S, J provides an abstract base class for streaming data to or from a remote database through a remote Qorus instance and also provides static helper methods
DbRemote W, S, J provides an API wrapper for all system.sqlutil service methods
DbRemoteReceive W, S, J provides an API for streaming data from a remote database through a remote Qorus instance
DbRemoteSend W, S, J provides an API for streaming data to a remote database through a remote Qorus instance
FsRemote W, S, J provides an API wrapper for all system.fs service methods
FsRemoteSend W, S, J provides an API for streaming data to a remote filesystem through a remote Qorus instance
JobApi J the primary job API class
QorusInboundTableMapper W, S, J provides an API for mapping data to a DB table
QorusInboundTableMapperIterator W, S, J provides an iterator-based API for mapping data to a DB table
QorusRawSqlStatementOutboundMapper W, S, J provides an API for mapping from SQL statement using direct SQL statements passed in
QorusRemoteServiceHelper W, S, J provides an API for calling service methods in remote Qorus instances
QorusSqlStatementOutboundMapper W, S, J provides an API for mapping from SQL statement using SqlUtil
QorusSystemAPIHelper W, S, J provides an API for calling RPC API methods in remote Qorus instances
OMQ::QorusSystemRestHelper W, S, J provides an API for using the REST API in remote Qorus instances
UserApi W, S, J the primary shared Qorus API class

Job API Modules

The following modules are imported by default into job program logic containers:

Name Availability Description
json W, S, J provides APIs for JSON data serialization and deserialization support
Mime W, S, J provides MIME definitions and functionality
Mapper W, S, J provides a data-mapping API
SoapClient W, S, J provides a SOAP client API
SqlUtil W, S, J provides high-level APIs for programmatic DML (SQL data manipulation), DDL (creating, querying, manipulating database definitions), and DBA operations
TableMapper W, S, J provides high-level APIs for mapping data to and from database tables
Util W, S, J provides utility APIs
uuid W, S, J provides an API for generating UUIDs
xml W, S, J provides APIs for parsing, validating, and generating XML documents
yaml W, S, J provides APIs for Qore's YAML-based data serialization and deserialization support
Note
other modules can be imported using the %requires directive, and it's always safe to %require a module that's already imported into the current Program container

Job API Overview

This section lists all of the API methods specific to jobs; the main job API classes are:

Note
See also
  • Qorus Common Server API for APIs and API concepts common to all Qorus server code (workflows, services, and jobs).
  • Qorus Common API for a definition of API definitions common to all Qorus user code (workflows, services, and jobs) as well as the client library.

Logging APIs:

API Method Description
JobApi::err() raises job errors with mandatory error and description string arguments
JobApi::errWithInfo() raises job errors
JobApi::getStateData() retrieves job state data if available
JobApi::getInfo() retrieves information about the currently-executing job
JobApi::saveInfo() saves information about job processing agaainst the job instance record
JobApi::saveStateData() saves job state data against the current job instance
JobApi::setTrigger() sets a custom trigger time for the next job instance
UserApi::sleep() safely pause execution for a defined period of time
UserApi::usleep() safely pause execution for a defined period of time
JobApi::warnWithInfo() raises job warnings
Qorus Integration Engine®