Modeling two start events in BPMN

Hello, BPMN newby here…I’m curious what is the correct way to model a scenario where there are two events (which may arrive in any order); one starts the flow and the other is needed further down. I see it is possible to have two start message events, but how to communicate between the two separate execution flows (i.e. save data to a db, use variables, pass messages, etc.) Thanks!

Hi @curiouscat,

if you want to wait for two events at the beginning of your process, you can model something like this:

twoStarts

With the event-based gateway you can wait at the gateway until one event happens. The path of the event that happens first will be taken.

I don’t know which scenario you are trying to model, but event-based gateways are a good starting-point if you want to wait for different events.

Hope this helps.

Regards
Michael

Thanks Michael. Is there an advantage to doing it that way versus having two start events? I’m still not sure how I’d pass information/wait on the second event (in my case, I need both event types in order to complete the execution).

Is this the alternative you’re talking about @curiouscat ?

This would only work if both messages are using the same businessKey - the first message will always start the process with the businessKey and the second message will continue the process provided it has the same business key as the first message.

1 Like

Thanks, I’ll try that! Looks nice and simple.

Sorry, if you don’t mind a quick follow up q: I was planning on running this on kubernetes; assuming there are multiple pods/engines running, there is obviously a scenario where two events/messages would end up on different pods. I am assuming the only way to deal with this would be to write events to the shared db, as I would not think this would work as intended in that scenario?

That wouldn’t be an issue if all the engines where connected the same datasource. the only danger is that the 2 messages come in at the same time it’s possible they could start 2 different processes because the first message wouldn’t have time to commit it’s state before the second one arrives.

Ok thanks, I think I get that now.

What is the recommended way of dealing with the issue you are describing? In my case I don’t have control of making the service task calls idempotent, so two flows would be bad…

Hello! Is this model correct?

Yes, It’s.