Executor
Executor is a configuration file (nme-executor.xml
) that lets you define task listeners that can perform actions (for example, call an external application) when the executor starts or finishes a task (load, export, processDelta call).
Executor task listeners
Task listeners allow executing custom code when a task status changes (for example, a task is enqueued, started, stopped, finished, failed). Every task listener has the following parameters (that is, code fragments executed or templates used when the state of the task changes accordingly):
-
whenEnqueued
- Task is put in queue and is waiting to be processed. -
whenStarted
- Task is started. -
whenSucceeded
- Task was successfully completed. -
whenFailed
- Task failed. -
whenAborted
- Task was stopped in a high availability (HA) RW-RO transaction. -
whenStopped
- Task was stopped after successfully starting. -
whenCanceled
- Task was cancelled while in queue.
In the parameters listed, the following information about each task is available. Every listener has its own syntax for referring to these variables.
-
TASK_ID
- Numeric task ID visible in the console. -
TASK_TYPE_ID
- String ID of the task (for example, "batchLoad.system1_full"). -
TASK_NAME
- Human readable task name (for example, "Batch load system1_full"). -
ERROR_MESSAGE
- Error message. If no error occurred, this is an empty string. -
TP_transactionId
- All task properties in the formatTP_propertyName
. Available only inwhenSucceeded
,whenFailed
,whenAborted
statuses.-
transactionId
- Must always be defined. Other properties can be defined in a batch operation or passed through the service call.
-
WorkflowTaskListener
WorkflowTaskListener allows running eWF workflows.
Additional information about the task is available as semi-expression variables, with the ${VARIABLE}
syntax.
<listener class="com.ataccama.nme.ext.workflow.WorkflowTaskListener">
<whenSucceeded>
<workflowName>someWorkflow.ewf</workflowName>
<params>
<param name="TASK_ID" expression="${TASK_ID}" />
<param name="TASK_NAME" expression="${TASK_NAME}" />
</params>
</whenSucceeded>
</listener>
Parameters:
-
workflowName
- ID of the workflow to run (including the.ewf
extension).
ShellTaskListener
ShellTaskListener allows executing Shell commands. Additional information about the task is available as enviroment variables.
<listener class="com.ataccama.nme.engine.monitoring.ShellTaskListener">
<whenSucceeded>
mail -s "$TASK_NAME has finished" admin@domain.com <<EOT
$TASK_NAME ($TASK_ID) has successfully finished.
EOT
</whenSucceeded>
<whenFailed>
mail -s "$TASK_NAME has failed!" admin@domain.com <<EOT
$TASK_NAME ($TASK_ID) has failed.
EOT
</whenFailed>
</listener>
Parameters:
-
interpreter
(default:/bin/sh
) - Which command is used to execute the script (on Windows, usecmd /c
). -
fileSuffix
(default:.sh
) - Extension for the temporary file created (on Windows, use.bat
or.cmd
).
In addition to task information, the script fragments can use all the environment variables passed to the Java command for running MDM.
SqlTaskListener
SqlTaskListener allows executing SQL queries on a given database. Additional information about the task is available as name-binded variables.
<listener class="com.ataccama.nme.engine.monitoring.SqlTaskListener">
<dbConnection>someDB</dbConnection>
<whenSucceeded>
INSERT INTO TASK_LOG(id, name) VALUES(:TASK_ID, :TASK_NAME)
</whenSucceeded>
<whenFailed>
INSERT INTO TASK_LOG_ERROR(id, name, message) VALUES(:TASK_ID, :TASK_NAME, :ERROR_MESSAGE)
</whemFailed>
</listener>
Parameters:
-
dbConnection
- Name of the database connection defined in the main server configuration.
HttpSoapTaskListener
HttpSoapTaskListener allows calling external services.
Additional information about the task is available as semi-expression variables, with the ${VARIABLE}
syntax.
Use the CDATA
section to include a message in the configuration XML file.
<listener class="com.ataccama.nme.engine.monitoring.HttpSoapTaskListener">
<urlResourceName>task_status</urlResourceName>
<soapAction>action</soapAction>
<whenSucceeded>
<![CDATA[
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://www.example.com/ws">
<soapenv:Header/>
<soapenv:Body>
<ws:action>
<ws:id>${TASK_ID}</ws:id>
<ws:name>${TASK_NAME}</ws:name>
</ws:action>
</soapenv:Body>
</soapenv:Envelope>
]]>
</whenSucceeded>
</listener>
Parameters:
-
urlResourceName
- Name of the URL resource defined in the server runtime configuration file (see Runtime Configuration). -
soapAction
- URL of the target web service. -
timeout
(optional, default:5000
) - Timeout in milliseconds. If the target web service does not respond in time, the request is considered as a timeout. -
soapVersion
(optional, default:SOAP_1_1
) - EitherSOAP_1_1
for SOAP version 1.1 orSOAP_1_2
for SOAP version 1.2. -
encoding
(optional) - Request encoding. -
obsolete (use
urlResourceName
instead):-
url
- URL of the target web service. -
username
(optional) - Username in case authorization is required. Only HTTP Basic authorization is supported. -
password
(optional) - Password. Encrypted passwords are supported.
-
Was this page useful?