What is the best distro to implement execution listeners in a distributed system?

Hi everyone,
I want to model a distributed system (services deployed individually). As I found in here I figured out that the best choice for me would be to use Camunda Run and to implement external type service tasks.
Now, I also need to implement some execution listeners. I know how to do that using Tomcat ditro (or even Spring boot, which is not useful for my case as it can not be used in a distributed system). I have two question now:

  1. Is Tomcat distro a better option at this case? to implement execution listeners and have a distributed system at the same time?
  2. If Camunda Run is better even in this case, how should I implement and deploy java classes?

I do really appreciate it if anyone could help me.

Hi @NSh,

I would go with the Spring-Boot approach: Spring Boot Integration | docs.camunda.org

That’s the most easy way to start the process engine with your own listener classes.

Camunda Run is build on the Spring-Boot distribution as well.

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,
Thanks for your quick response.
As I know, spring boot can not be used for distributed systems, as all java classes should reside inside a project (as well as the process) and be deployed together. It is also mentioned in this camunda blog that Camunda Spring Boot is for times when “You want to orchestrate local services”.
Or am I misunderstanding anything?

Hi @NSh ,

Why do you need to implement execution listeners? Is there another way to accomplish what you need using only the external task worker pattern and the model?


Hi @jwulf,
I need it for some cross cutting concerns. I thought it would be the better choice. Otherwise, I have to add some external task, before every where I need to add that concern. Do you suggest something else for cross cutting concerns? like a way to implement aspect oriented in BPMN?

Hi @NSh,

in general you need some glue code to connect your services with the process engine.

In the past many people, especially Java developers, ran the glue code in the Java process of the engine. The glue code implements the JavaDelegate interface. And to run it easly, you can use the SpringBoot starter for the process engine.

If you don’t want to write the glue code in Java, you can use the external pattern and write the glue code in .net or JavaScript or… With the rise of Microservices, you can also put the glue code, implemented in an external task worker, in your domain implementation. Camunda Run is the perfect platform here as it easy to configure, even for people without a decent Java knowledge.

It is more difficult to deploy listeners to Camunda Run, but it depends on the requirements, which alternatives are available:

  • Data mapping could be done with input- output mappings on the tasks (Process Variables | docs.camunda.org).
  • Pushing data to different systems could be done with message send events and either a java delegate or an external task worker. (The events are less intrusive to the reader than tasks, if they serve just technical reasons, Message Events | docs.camunda.org).

There may be other use cases where code would be the best solution, but it’s always worth to go to the detailed requirements.

Hope this helps, Ingo


Building on what @Ingo_Richtsmeier said: could you not do aspect-oriented programming in your workers?

So the cross-cutting concern could be a library, and you annotate your worker task handler.

This would couple it with a task type.


1 Like

Hi @Ingo_Richtsmeier,
Thanks a lot for your answer.
So, we can implement a java delegate for each service task in Spring Boot, and call the related service for example by a Rest API. Then I can add aspects even to java delegates, but also use execution listeners for components other than service tasks (e.g., events, …). And if I need to use the external pattern for some tasks, I can add aspects to them as well (or use listeners again).
However, if I don’t want to use java for the glue code, I should use Camunda Run and external tasks, which on the other hand makes it difficult to add execution listeners to events, … . And listeners are in java any way.

Dear @jwulf,
Thanks for your response.
Yes that works for workers, but I need them also for other components, e.g., events, …