jBPM provides options to configure notification emails to be send to any user if the human task is not started or not completed.
We will start with configuring JavaMail sessions via JNDI so that infrastructure for mail is handled.
We would be using “jbpm-server-7.37.0.Final-dist” version for this example.
Configure Mail Session in wildfly
In the standalone configuration for jBPM we need add below configurations.
Configure Socket binding for smtp-port
<outbound-socket-binding name="mail-notification-smtp"> <remote-destination host="smtp.gmail.com" port="465"/> </outbound-socket-binding>
host -: host name of SMTP server
port -: port no of SMTP server.
Configure Mail-Session in Mail subsystem
<mail-session name="notification" jndi-name="java:/notificationMailSession" from="email@example.com"> <smtp-server outbound-socket-binding-ref="mail-notification-smtp" ssl="true" username="firstname.lastname@example.org" password="yourPassw0rd"/> </mail-session>
from -: From address for your emails (Valid email account on SMTP server).
username -: username for the email account
password -: password for the email account.
Add below system property to standalone.xml file.
<system-properties> <property name="org.kie.mail.session" value="java:/notificationMailSession"/> </system-properties>
Configure user info for Human task
Next step would be to configure email info for users used by the human task. You will have to create file named “userinfo.properties” with below content at location “kie-server.war/WEB-INF/classes”.
email@example.com\:en-UK\:john Administratorfirstname.lastname@example.org:en-UK:Administrator email@example.com:en-UK:wbadmin:[john]
You can enter email details for all users in the above file. Make sure the Administrator user is present in the file.
Configuring Notification for Human task in process definition
Final step would be configure notifications for human task in a process definition. Follow below steps for that.
- In buisness-central click on human task for which notification needs to configured.
2. Select “Edit” notifications from the property section in right hand side.
3. Click on “Add” button to add new notification.
4. jBPM allows you to configure 2 types of notifications -: Not Started and Not Completed.
5. Select the type of Notification to be configured by clicking on “Not Started” or “Not Completed” radio button.
6. You can configure Notification time using 3 options
a) Time Period -: You can specify period after which notification would be send in minutes, hours, days, months, years. This also provides repeat option as well.
b) Date -: You can pass actual date along with time zone.
c) Expression -: You pass time in ISO 8601 expressions syntax as well.
7. In Message section you can select.
from -: User from whom notification would be send. You can select only one user
to -: Users or Groups to whom notification will be send. You can select multiple users or groups.
Please ensure the users email info is present userinfo.properties file.
You can then enter email Subject and email Body to be send as part notification.
8. You can add multiple notification by clicking on Add button.
9. Save the file, then build and deploy the project.
10. Since we configured “Not Started” type of notification with time period 1 min. If the human task is not started with in 1 min of process start then a notification email would be triggered.
If you are getting below error when notification is triggered cross check if your username and password is correct. Also in case of gmail check if you enabled Less secure app access in account settings if you are testing in your local.
22:36:00,603 ERROR [org.jbpm.services.task.deadlines.notifications.impl.email.EmailNotificationListener] (EJB default - 3) Unable to send email notification due to 535-5.7.8 Username and Password not accepted. Learn more at
You can refer to https://github.com/kiegroup/jbpm/blob/master/jbpm-human-task/jbpm-human-task-core/src/main/java/org/jbpm/services/task/deadlines/notifications/impl/email/EmailNotificationListener.java for more details on EmailNotificationListener class.
Refer my blog https://techblogtoprogram.wordpress.com/2020/07/19/configuring-db-based-user-login-and-task-notifications-for-jbpm/ for configuring user info in DB for sending notification.