cancel
Showing results for 
Search instead for 
Did you mean: 

messageEventReceived before process has reached Message Catching Event

boekhold
Champ in-the-making
Champ in-the-making
Hi,

Let's say I start a process instance that does some processing, possibly involving user tasks, and then uses a Message Catching Event at one point in the flow. The process is not supposed to continue processing beyond that Message Catching Event before the specific message is 'caught'.

The actual delivery of the message is triggered by some external process (for sake of argument: the REST API), and uses Runtime.messageEventReceived().

What will happen if messageEventReceived() is called before the Message Catching Event is reached. Will the process then just be stuck on the Message Catching Event, or does Activiti somehow 'buffer up' unconsumed messages?

Maarten
3 REPLIES 3

boekhold
Champ in-the-making
Champ in-the-making
Hmmm, seems like I am confused about what an "executionId" really is. I understand now that it actually refers to a specific execution of a specific task/activiti. For me that means that what I really want to do is something like:

  • find a specific ProcessInstance
  • For that ProcessInstance, find the Execution that's waiting for this specific message
  • deliver to that execution
So I suppose the real question is: how do I handle the case where (1) I know that eventually there will be an execution listening to this message, but (2) that point has not been reached yet.

trademak
Star Contributor
Star Contributor
Yes you are correct about the Execution id. This does however also mean that the message catching event should already be reached in the process instance. Is it not possible to create the Message catching event earlier on in the process definition to make sure it's reached, by using a parallel gateway or so?

Best regards,

boekhold
Champ in-the-making
Champ in-the-making
Hi Tijs, yes, I had not thought of using a parallel gateway for this. I think this will work. There's still a tiny opportunity for a message to arrive before the Message Catching event has been reached, but that's mostly theoretical I suppose.

Thanks for the suggestion.

Maarten