User Community Service Desk Downloads

Executor

Executor is a configuration file (nme-executor.xml) that lets you define listeners that perform actions (for example, call an external application) when background tasks or event handlers change state.

The configuration is located in etc/nme-executor.xml.

<executor>
  <taskListeners>
    <!-- Task state change listeners -->
  </taskListeners>
  <eventHandlerListeners>
    <!-- Event handler state change listeners -->
  </eventHandlerListeners>
</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 format TP_propertyName. Available only in whenSucceeded, 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 &lt;&lt;EOT
        $TASK_NAME ($TASK_ID) has successfully finished.
EOT
    </whenSucceeded>
  <whenFailed>
    mail -s "$TASK_NAME has failed!" admin@domain.com &lt;&lt;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, use cmd /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) - Either SOAP_1_1 for SOAP version 1.1 or SOAP_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.

Event handler listeners

Event handler listeners monitor the operational state of event handlers and perform actions when the state changes. This is useful for triggering notifications or external processes when an event handler becomes active, inactive, or turned off.

For information about event handler states, see Streaming Event Handler > Monitoring and observability.

The following state transitions are available:

  • whenActivated - Handler is now active.

  • whenInactivated - Handler is now inactive.

  • whenDisabled - Handler has been turned off.

In the parameters listed, the following information about each event handler is available:

  • name - The name of the event handler.

  • state - The current state of the event handler.

  • type - The type of the event handler.

WorkflowEventHandlerListener

WorkflowEventHandlerListener allows running eWF workflows when an event handler state changes.

The XML elements use a Template suffix (for example, <whenActivatedTemplate>).
<eventHandlerListener class="com.ataccama.nme.ext.workflow.WorkflowEventHandlerListener">
  <whenActivatedTemplate workflowName="handler_activated.ewf">
    <params>
      <param name="handlerName" expression="{name}"/>
      <param name="handlerState" expression="{state}"/>
    </params>
  </whenActivatedTemplate>
</eventHandlerListener>

Parameters:

  • workflowName - ID of the workflow to run (including the .ewf extension).

HttpEventHandlerListener

HttpEventHandlerListener allows performing HTTP calls when an event handler state changes.

<eventHandlerListener class="com.ataccama.nme.engine.monitoring.HttpEventHandlerListener">
  <url>http://example.com/webhook</url>
  <method>POST</method>
  <whenActivated/>
  <whenDisabled/>
</eventHandlerListener>

Parameters:

  • url - URL of the target service.

  • method (default: POST) - HTTP method.

  • username (optional) - Username for HTTP Basic authorization.

  • password (optional) - Password.

ShellEventHandlerListener

ShellEventHandlerListener allows executing shell scripts when an event handler state changes.

<eventHandlerListener class="com.ataccama.nme.engine.monitoring.ShellEventHandlerListener">
  <whenDisabled>
    echo "Handler $name has been disabled" | mail -s "Handler alert" admin@domain.com
  </whenDisabled>
</eventHandlerListener>

Parameters:

  • interpreter (default: /bin/sh) - Which command is used to execute the script.

  • fileSuffix (default: .sh) - Extension for the temporary file created.

SqlEventHandlerListener

SqlEventHandlerListener allows executing SQL statements when an event handler state changes.

<eventHandlerListener class="com.ataccama.nme.engine.monitoring.SqlEventHandlerListener">
  <dbConnection>someDB</dbConnection>
  <whenActivated>
    INSERT INTO HANDLER_LOG(name, state) VALUES(:name, :state)
  </whenActivated>
</eventHandlerListener>

Parameters:

  • dbConnection - Name of the database connection defined in the main server configuration.

Was this page useful?