Email Executor

The Email executor sends the
configured email to the specified recipients upon receiving an event. You can also
configure the executor to send an email based on a condition, such as the arrival of a
specific type of event.

You can configure the Email executor to send multiple emails, each with its own
condition, set of recipients, and email message. You can use expressions in all email
fields.

Before you use an Email executor in a pipeline, you must enable Data Collector to
send email. For more information about configuring Data Collector
and other ways to configure notification, see Sending Email.

Prerequisite

Before you run a
pipeline that includes the Email executor, define the email alert properties in the Data Collector
configuration file, $SDC_CONF/sdc.properties.

For more information about enabling Data Collector to
send email and different ways it can send email, see Sending Email.

Conditions

You can configure the Email executor to send an
email based on a condition, such as the type of event to trigger the email. If you omit
a condition, the Email executor sends the email each time it receives an event.

For example, say you have a pipeline that uses a JDBC Query Consumer origin. The origin
generates several types of events: one for query success, one for query failure, and one
for the processing of all available data. To have the Email executor send a email only
when a query fails, you use the event type in the email condition, as
follows:

${record:eventType() == 'jdbc-query-failure'}

The event type is stored in the record header attribute of every event record. The
expression language provides the record:eventType() function to return
the event type for event records.

To determine the event type to use on the right side of the condition, review the "Event Record"
documentation for the stage. In this case, jdbc-query-failure is the event
type for JDBC Query Consumer query failure events.

Tip: By using conditions, you can route multiple event streams to the same
Email executor and configure all event-driven email notification in the executor.
For an example, see Case Study: Sending Email.

Using Expressions

You can use
expressions in any email property in the Email executor. For example, you can base the
condition on information in the event record, and include information about the pipeline
in the email message.

You can use any functions that work for your use case, but here are some suggestions:

pipeline functions

You can use the pipeline functions to provide pipeline information such
as the pipeline name and ID.

For example, you can use pipeline:title() and
pipeline:id() in the email message to indicate the
pipeline that generated the event and email. You might use the following
message when the email is configured to send after the Pipeline Finisher
stops the
pipeline:

You can use record functions to provide information from the event record.
For example, you should use record:eventType() in the
condition if the pipeline routes multiple types of events to the Email
executor and you want to send the email only upon receiving a particular
event type. If you use the executor with the JDBC Query Consumer, you can
use the following condition to send the email when a query successfully
completes:

${record:eventType() == 'jdbc-query-success'}

You
might also use the record:eventCreation() function to
include the time that the event occurred in the message. The creation
time is returned in epoch time, so to create a readable timestamp, you
can use the following
expression:

${time:millisecondsToDateTime(record:eventCreation() * 1000)}

And
of course, you can use the record:value function to
include information from the event record, such as the query that
successfully completed.

file functions

You can use file functions to provide information about a closed or written
file.

For example, you might use the file:fileName function to
extract the name of a closed file from the filepath field of a Hadoop FS
file-closure event as
follows:

${file:fileName(record:value('/filepath'))}

Configuring an Email Executor

Configure an
Email executor to send email upon receiving events.

In the Properties panel, on the General tab, configure the
following properties: