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.
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 pattern | This select box contains all predefined email patterns. If user chooses any of them, all fields below are automatically filled by values from pattern. |
| To | Recipient's email address. It is possible to specify more addresses separated by comma. It is also possible to use placeholders. See Placeholders for details. |
| Cc | Cc 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. |
| BCc | Bcc: 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. |
| Subject | Email subject. It is also possible to use placeholders. See Placeholders for details. |
| Plain text | Body 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. |
| HTML | Body 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 attachment | If this switch is checked, email will have an attachment with packed log file of related graph execution. |
Note: Do not forget to configure connection to SMTP server (See Chapter 16, Configuration for details).
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.
event
now
user
run
sandbox
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 name | Contains |
|---|---|
| now | Current date-time |
| user | User, 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) |
| run | Data 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 |
| tracking | Data 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
} |
| sandbox | Data structure describing sandbox containing executed graph. Contains sub-properties, which are accessible using dot notation (i.e. ${sandbox.name}) name, code, rootPath |
| schedule | Data 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 |
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 name | Full 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 name | JNDI name of connection factory. Depends on JMS provider. |
| Destination | JNDI name of message queue/topic on the server |
| Username | Username for connection to JMS message broker |
| Password | Password for connection to JMS message broker |
| URL | URL of JMS message broker |
| JMS pattern | This select box contains all predefined JMS message patterns. If user chooses any of them, text field below is automatically filled by value from pattern. |
| Text | Body of JMS message. It is also possible to use placeholders. See Placeholders of send email task for details. |