quarta-feira, 22 de fevereiro de 2017

Registering a custom process event listener in jBPM or BPM Suite

Two Steps are required to  use a custom process event listener in jBPM 6.5 or BPM Suite 6.4:


1) Create the class that implements org.kie.api.event.process.ProcessEventListener . This class can be in your BPM Suite project or in a separated dependency. In any case you will need the org.jbpm:jbpm-flow:6.5.0.Final maven dependency in your project. If you use a separated maven project with your process event listener, make sure to add it as a dependency;



2) Register the custom listener in kie-deployment-descriptor.xml  on the "Event Listeners" sections and use the full qualified class name and the resolver as reflection.



Now if you execute a process your process event listener methods should be called. For example, I have the following simple test processes:


And in my process event listener I did override the before node triggered method to print the node name, so when I execute the business process I see the following in console:




See the code for a simple process listener and you can find also in my github.