Configurable correlation

Hi there,

I’m trying to do a proof of concept with Camunda as a way to implement customer specific extensions to an event driven software system. This system publishes domain events as artifact to any change, e.g. PersonCreated, PersonChanged, ActivityCreated, ActivityDeleted and so on.

I would like to use Camunda to implement highly specific functionalities outside of this software system. Imagine doing something after the first activity for a new person was created. However, it could be really anything. So what I’m looking for is basically a configurable approach to

  1. start a process on a specific domain event (also maybe looking into the data of the event and not only the type)
  2. message running processes about a specific domain event (e.g. in our example from above, indicate in the process that I’m waiting for an ActivityCreated event for person XYZ).

The thing is, that I would like to build that more in a way of a framework. So all this routing should be more configuration, then hard coding. Currently, I run a Spring Boot application with embedded Camunda. My current plan is to build something like a configurable chain of filters on the received domain events that will execute an action when we have a match. The action can be “start new process xyz”. I think this is doable. I’m a little bit lost how I can route domain events as messages to a running process though. I understand that I have to correlate the message accordingly. But how can I do this efficiently from within the process?

Is there any previous work or best practices known for such a “router” module for Camunda?

Thanks a ton.

1 Like

Hi @spa,

some of your requirements are already covered by message handling in the engine.

If you use the businessKey to identify a running process and use the same message name for all message receive tasks or events (including the start event), you are done.

The engine will decide by itself if a new process instance gets started (business key unknown but set when starting) or an existing process instance is continued (business key is used to identify the process).

Requirement: the business key has to be unique, otherwise you will get MismatchingMessageCorrelationExcpetions.

Hope this helps, Ingo

Whenever I hear “configurable chain of filters”, I think of apache camel … have a look at the camunda camel extension and check if “wiring” your event stream to the engine.

Interesting approach, please share when you make progress.