Send Notification using Chain If Else step in ETL

This guide will show you how to send an email notification using the Chain If Else step in an ETL chainset. It’s useful for sending alerts or notifications if an issue arises while running a specific job in your ETL chainset.

Pre-requisite

Attached files.zip contains batch files and the ETL chainset used in this guideline. It is advisable to configure the email SMTP account in application.conf first prior doing this guideline.

1/ Add the batch files to your working directory e.g below my working directory is at “C:/app/external command”. Then create a text file called TextDocument.txt in the same directory. Edit the path in each of the .bat files provided.

Revise the application.conf file

ambience.etl {
  external {
    run-command {
      commands {
        echo:"echo"
        # full path required in some cases
        # phantomjs:"/usr/local/bin/phantomjs-2.1.1-macosx/bin/phantomjs"
		housekeeping:"C:/app/external command/removefile.bat"
		echoSuccess:"C:/app/external command/echoSuccess.bat"

2/ Run command step will executes the housekeeping batch file:

3/ Array Length step will derives the value from the “error” field to the “length” field. [0=No Errors, >1=Have Error(s)]:

Has error

No error

4/ Equal Value step derives a boolean from “length” field, 0 = True, greater or equals 1 = False

5/ Chain If Else step executes either chain #02_ExternalCommand_Success or #03_ExternalCommand_Error based on the result value

6/ The message in row 2 under the output field depends on either chain #2 or #3

Chain #2 If the External Command is successful

Chain #3 If the External Command is not successful it will send a alert / notification to your email.

7/ You may revise the message and the subject in the email notification inside the chain #3


files.zip (1.2 KB)