Best practice/usecase to create and use Process Engine plugin

Most of the use cases of the Process engine plugins execution are at the time of Start/End event of the activity or Create/Assign/complete/delete event of the activity. This can also be achieved by configuring ExecutionListener/TaskListener/JavaDelegates in any activity.

For example, camunda-connect plugin functionality can be achieved in Java Delegates/Listener itself. Then why i need process engine plugin?

When i use camunda-bpm-email-connect plugin, i used freemarker templates for email, Camunda-freemarker doesn’t provides the flexibility to read config like templates, mail config properties from external resources(Hashicorp vault, cloud storage)/file system, its always lookup in classpath for resources. Whenever we need to change a freemarker templates, everytime i have to redeploy the springboot for the changes to reflect.

I got the below insights when i thought about exceptional usecases for process engine plugins:

  • Few exceptional scenarios are like Deploy event/Undeploy event, Post/Pre process engine build activities, special events etc. or where we can’t configure the listeners/delegates, in that case it can be handled by process engine plugins
  • Expose the utility to avoid boilerplate code/simplifying the development for more productivity by minimal configuration

Is there any scenario/usecase where i can prefer to use ProcessEngine plugins over the Listeners/Delegates?

Hi @aravindhrs,

you are in the right track.

I would use a process engine plugin to either extend the process eingine with custom functionality or put tedious, error prone task configuration of listeners into the engine and remove it from the modeler, as the described in this example:

How to add the task listener to every User Task

Hope this helps, Ingo

@Ingo_Richtsmeier thanks for your reply :blush:.

So if I add a process engine plugin, it will execute the code for all the process definitions. How can we control that not to execute the certain process engine plugins for few process definitions?

I hope it can be done by configuring extension element in model, is there any other better way to do it?

Hi @aravindhrs,

you can control this with if() statements in your plugin code.

The plugin is only executed for processes or tasks that match certain conditions.

Hope this helps, Ingo

@Ingo_Richtsmeier Thanks for the solutions :blush: