WorkFlow Instance creation based on message start Event

Hi,
Currently I have some requirement i.e. based on a new message published to zeebe, it should automatically create a new instance of a specific workflow and it starts executing .I can see “Message start event” is there through which I can implement my requirement but the problem is, even after the message is already subscribed by an active workflow instance ,the Message start event which is part of a separate workflow get triggered and starts creating a new instance .
is there a way we can limit the message subscription limit, like if it is subscribed by any active workflow instance then Mesage start event should not get triggered.

Or, please suggest me if there is any other way to achive my requirement.

1 Like

Hi @gunanidhi,

welcome to the Zeebe community :tada:

Regarding your question:

No, there is no configuration option. Please have a look at the docs: Zeebe | Camunda 8 Docs

Can you share an example that shows the problem?

Best regards,
Philipp

1 Like

Here is one way you can do it, if I understand your problem.

You could have a message start event, and put the whole process in a subprocess. Then put a boundary message event on the subprocess with a correlation key on it.

Then your start message uses a correlation key, so while that process is running, any further messages with the same correlation key will be correlated with the running instance boundary event.

Hi Philipp,
thanks for the update, please find my below comment.

zeebe docs says : (Under section : Message Cardinality)
A message is not correlated to a message start event subscription if an instance of the workflow is active and was created by a message with the same correlation key. If the message is buffered then it can be correlated after the active instance is ended. Otherwise, it is discarded.

But, I tried it and even though a message is already correlated with some active workflow instance which has correlation key, message start event is getting triggered after the active workflow instance completed.

Hi jwulf,
Thanks for the response, this is a nice idea that I can implement in some other requirement, but in the current requirement it requires lots of changes, i have use cases something like below:

There are number of workflows(around 50) created, and in all workflow an asynchronous task attached (by message catch event), so the workflow waits for a message event and after message correlated it executes and complete it.

but there are some use cases where message catch event has to wait for a longer period of time (it may be in days/months/years), its because our application is callig to a third party system and on the scheduled date(could be after 2months ) the third party will give a call back,
in this case my workflow has to wait for a message correlation for longer period of time which is not reliable (got comment from [Peter Ihme] from slack), hence we decided to not wait for a longer period of time, instead we can complete the workflow after calling to third party system , when the callback from thirdparty system comes that time a workflow instance will trigger by the help of message start event, and that is happening in my case also but the problem is even though published message is already correlated by some other active workflow instance it is still triggering the message start event, which is a violation to Message Cardinality mentioned in zeebe docs.

Are you saying that a message is correlated with a start event and an intermediate event?

Hi Jwulf,
sorry for my late reply,
Yes, message is correlated with an intermediate event first and when the worflow instance completed , then correlated with a start event of different workflow also.

What timeToLive do you set on the message?

TTL value I set to zero and also tried but stil message is correlated with two event. below is the command I used

zbctl publish message ProductOrderFullfilled --correlationKey PO4825 --ttl 0