- User story
- First task : echo a status
- Second task : send an email
- Creating the workflow
- Testing it
“I want to create a task that outputs a status. Then, I want to send this status in a dedicated email.”
Although it is possible to use the notification system in this specific case, it is still interesting to explain how dynamic parameters work. Dynamic parameters are used the send a task's output as input to a child task.
First task : echo a status
To use dynamic parameters, it is recommended to use XML output. So first we will create a task that outputs an XML with the status :
#!/bin/bash echo "<status>No error have been reported</status>"
evQueue has a special directory where you can place your own tasks. It is controlled by the processmanager.tasks.directory directive of the configuration file. You should place the above script in this directory and make it executable:
Next, go the the task management screen: Settings -> Tasks and create a new task ( icon). Ensure you have set it's output mode to XML ('Input / Output' tab).
Second task : send an email
For this simple task, we will use the 'mail' command line tool provided in debian. The email body will be passed as first (and unique) parameter on the command line. Here is out 'mail_status.sh' script :
#!/bin/bash echo $1 | mail -s 'Status' firstname.lastname@example.org
Of course, change the email address with yours.
Create the task, this time in text output mode, which is the default. Name it 'mail_status'.
Creating the workflow
Create a new workflow, name it as you like.
The first task (output_status) takes no parameters, so you just have to drop it in the empty job. you get this :
Add the second task (mail_status) after the first one :
Edit the second task's parameters. Add one parameter named status and add on part of type 'XPath value'. Set the settings as follow :
Add the part, you should get this :
Exit the workflow edition and save your changes.
Well... if you made everything good, you should juste have to launche the workflow and wait for the email.