Eric D. Schabell: JBoss BPM Suite Quick Guide: Automating Email User Task Notifications (part 2)

Thursday, April 9, 2015

JBoss BPM Suite Quick Guide: Automating Email User Task Notifications (part 2)

Previously we went through a project where there was a bit of trouble around the completion of user tasks in a timely manner.

We showed you how to setup automated task reassignment for any task that was claimed from the group and then not completed in a timely manner.

We had the task reassigned back into the group for others to work on.

Little did we know this would not be enough to make this process project run smoothly for our users, so read on in this first part one of two articles that will lead you through setting up email notifications for your processes.

The problem

After putting this into production we noticed that it was not enough to just assume that users from a group would claim and complete tasks in a timely manner.

The issue that arose was that these users had no idea when a task was waiting for them as there were no alerts.

Figure 1: task properties to add notification.
We need to setup an email alert to be sent to the group and/or users when a new user task is added to the group and sits unattended for a specified period of time.

The configuration

Before we can actually use the JBoss BPM Suite process designer to setup our desired email notifications, we need to make sure our server is configured to process email notifications, knows our users and knows our groups.

Figure 2: notifications will open the editor.
See part one of this series for the details around configuration of a JBoss BPM Suite server for sending e-mail through the provided sub-system.

The notifications

We are now ready to a an email notification to our user task, the Approve Reward task in our example project.*

In the process designer select the user task, open the Properties panel on the right as shown in figure 1. Then open the Editor for Notifications found under the Extra Properties section as shown in figure 2.

Figure 3: body message.
In the editor we can add a new notification and fill in the fields with the following data:

  • Type: not-started
  • Expires at: 2m
  • From: Administrator
  • To Users: erics
  • To Groups: manager
  • Reply to: (leave empty)
  • Subject: Task needs attention
  • Body: (enter body of message, for example see figure 3)

The results should have your editor looking something like figure 4, after which we can save and commit our adjustments to the process.
Figure 4: notification for task completed.

If you configured the project yourself as shown in part 1 of this series, or if you are using the provided workshop demo project*, then you can now build and deploy to test the e-mail notifications in your process.

Within the default JBoss BPM Suite notification configuration, we have chosen to use the default mail setup. This is a setup that expects a local SMTP server (mail server) to listen for messages on port 25.

Figure 5: capturing e-mail notifications.
The easiest way to test this without setting up your own mail sever, is to make use of the provided fakeSMTP server as found in the support directory from our example project.*

You can run this as admin user and start the server to catch JBoss BPM Suite server e-mail notifications when you run your process and let the Approve Reward task sit in the group unclaimed for longer than 2 minutes:

$ sudo java -jar support/fakeSMTP.jar

When e-mail notifications are sent you should see them appear in the fakeSMTP applications window as shown in figure 5.

This concludes the series on automating e-mail user task notifications, where we configured the server and then showed you how to setup a user task to generate e-mail notifications.

[*In this article we will use the HR Employee Rewards demo project as a baseline, which you can also build from scratch by following the JBoss BPM Suite online workshop. If you obtain this project, follow the install instructions you will find a completed solution of what is described here.]