Iterate over multiple received messages

I’m trying to model a blind auction like in the following BPMN:

The question is: what about a new message is received while the task “Store encrypted offer” is running? The event is lost or the engine is able to manage it when returning to the event gateway?

Any suggestion to modify the BPMN in case the message was lost?

Regards

Davide

@ddozza I have done this in two ways in the past:

  1. Create a queue that holds the messages: such as RabbitMQ and delivers them.

  2. Create a “poor mans queue” with another process instance:

Here is a old example:

The “gist” is: Create a Message Start Event that captures all messages, and then have script event that re-correlates the messages to their proper destination. And as you can see in the example there are error handling that can be done as well.

PS: Neat use case you have!

Hey guys,

how about using an embedded sub process? Check out my model here:

https://cawemo.com/shares/f1006bd3-9f91-4515-a085-6fbe21318449

@ddozza: In your model, the engine will throw an exception if you try to correlate a message while the task is running. It depends on your messaging implementation in which way you would handle this.

Best,
Ben

3 Likes

Hi Ben,

I would suggest one small modification. There is a race condition between the auction closing and calculating a winner. Hence, Ive put the event driven sub-process in a nested scope to reduce the opportunity of the race condition…

regards

Rob

3 Likes

Very good point Rob!

1 Like

Thanks all for unvaluable suggestions.

@benhoffmann @Webcyberrob what about the event timer occurs while a store offer task is still running? The auction close event kills the subprocess or waits for completion?

What about using a boundary event like in the following example?

Davide

Auction close would not kill the store offer task but rather wait for completion (unless you make it a terminate event).

Your example works almost the same way. The only difference is that in your case store offer would not have access to any local variables of the sub process (not recommended anyway) and open offers could be executed while store offer is still running. That means there is a race condition again.