Tasks

Task types "execute shell command", "execute graph" and "archivator" are described in section "scheduling" see this section for details about these task types. There is one more task type, which is useful especially with graph event listeners, thus it is described here. It is task type "send email".

Note: You can use task of any type for both scheduling and graph event listener. Description of task types is divided into two sections just to show the most obvious use cases.

Task - Send Email

This type of task is useful for notifications about result of graph execution. I.e. you can create listener with this task type to be notified about each failure in specified sandbox or failure of particular graph.

Table 6.1. Attributes of "Send email" task

Task type"email"
Email patternThis select box contains all predefined email patterns. If user chooses any of them, all fields below are automatically filled by values from pattern.
ToRecipient's email address. It is possible to specify more addresses separated by comma. It is also possible to use placeholders. See Placeholders for details.
CcCc stands for 'carbon copy'. Copy of email will be delivered to these addresses. It is possible to specify more addresses separated by comma. It is also possible to use placeholders. See Placeholders for details.
BCcBcc: stands for 'Blind carbon copy'. It is the same as Cc, but the others recipients aren't aware, that these recipients get copy of email.
Reply-to (Sender)Email address of sender. It must be valid address according to SMTP server. It is also possible to use placeholders. See Placeholders for details.
SubjectEmail subject. It is also possible to use placeholders. See Placeholders for details.
Plain textBody of email in plain text. Email is created as multipart, so HTML body should have a precedence. Plain text body is only for email clients which do not display HTML. It is also possible to use placeholders. See Placeholders for details.
HTMLBody of email in HTML. Email is created as multipart, so HTML body should have a precedence. Plain text body is only for email clients which do not display HTML. It is also possible to use placeholders. See Placeholders for details.
Log file as attachmentIf this switch is checked, email will have an attachment with packed log file of related graph execution.

Web GUI - send email

Figure 6.2. Web GUI - send email


Note: Do not forget to configure connection to SMTP server (See Chapter 16, Configuration for details).

Placeholders

Place holder may be used in some fields of tasks. They are especially useful for email tasks, where you can generate content of email according to context variables.

Note: In most cases, you can avoid this by using email patterns (See Email task for details)

These fields are preprocessed by Apache Velocity templating engine. See Velocity project URL for syntax description http://velocity.apache.org/

There are several context variables, which you can use in place holders and even for creating loops and conditions.

Some of them may be empty in dependence of occasion which field is processed in. I.e. If task is processed because of graph event, then run and sandbox variables contain related data, otherwise they are empty,

Table 6.2. Placeholders useful in email templates

Variable nameContains
nowCurrent date-time
userUser, who caused this event. It may be owner of schedule, or someone who executed graph. Contains sub-properties, which are accessible using dot notation (i.e. ${user.email}) email, username, firstName, lastName, groups (list of values)
runData structure describing one single graph execution. Contains sub-properties, which are accessible using dot notation (i.e. ${run.graphId}) graphId, finalStatus, startTime, stopTime, errNode, errMessage, errException, logLocation
trackingData structure describing status of components in graph execution. Contains sub-properties, which are accessible using Velocity syntax for loops and conditions.
#if (${tracking})
<table border="1" cellpadding="2" cellspacing="0">
#foreach ($phase in $tracking.trackingPhases)
<tr><td>phase: ${phase.phaseNumber}</td>
    <td>${phase.execTime} ms</td>
    <td></td><td></td><td></td></tr>
   #foreach ($node in $phase.trackingNodes)
      <tr><td>${node.nodeName}</td>
          <td>${node.result}</td>
          <td></td><td></td><td></td></tr>
      #foreach ($port in $node.trackingPorts)
         <tr><td></td><td></td>
             <td>${port.portType}:${port.index}</td>
             <td>${port.totalBytes} B</td>
             <td>${port.totalRows} rows</td></tr>
      #end
   #end
#end
</table>
#end
}
sandboxData structure describing sandbox containing executed graph. Contains sub-properties, which are accessible using dot notation (i.e. ${sandbox.name}) name, code, rootPath
scheduleData structure describing schedule which triggered this task. Contains sub-properties, which are accessible using dot notation (i.e. ${schedule.description}) description, startTime, endTime, lastEvent, nextEvent, fireMisfired

Task - JMS Message

This type of task is useful for notifications about result of graph execution. I.e. you can create graph event listener with this task type to be notified about each failure in specified sandbox or failure of particular graph.

JMS messaging requires JMS API (jms.jar) and third-party libraries. All these libraries must be available on application server classpath. Some application servers contain these libraries by default, some do not, thus the libraries must be added explicitly.

Table 6.3. Attributes of JMS message task

Task type"JMS message"
Initial context class nameFull class name of javax.naming.InitialContext implementation. Each JMS provider has own implementation. i.e. for Apache MQ it is "org.apache.activemq.jndi.ActiveMQInitialContextFactory". If it is empty, server uses default initial context
Connection factory JNDI nameJNDI name of connection factory. Depends on JMS provider.
DestinationJNDI name of message queue/topic on the server
UsernameUsername for connection to JMS message broker
PasswordPassword for connection to JMS message broker
URLURL of JMS message broker
JMS patternThis select box contains all predefined JMS message patterns. If user chooses any of them, text field below is automatically filled by value from pattern.
TextBody of JMS message. It is also possible to use placeholders. See Placeholders of send email task for details.

Web GUI - Task JMS message editor

Figure 6.3. Web GUI - Task JMS message editor