AnsweredAssumed Answered

Message Notification

Question asked by samsmith on Feb 29, 2016
Latest reply on Mar 4, 2016 by martin.grofcik

I have got a question on the following scenario:

Lets say that I have a BPM process that has 2 steps:

'Human Task' followed by a 'Intermediate Catch Message Event'.

The below code works perfectly fine if I notify the instance that is already sitting in a 'Intermediate Catch Message Event'.
//Get the process instance Id from the
String processInstanceId=runtimeService.createProcessInstanceQuery().processInstanceBusinessKey("12345").singleResult().getId();

//Use the process instance id to get handle to Execution object.
Execution execution=runtimeService.createExecutionQuery().processInstanceId(processInstanceId).

runtimeService.messageEventReceived("testCatchMessage", execution.getId());

This code fails with a NullPointerException (because the 'Execution' object it returned was null) when I try to notify the instance that is sitting in a <HUMAN TASK> and NOT in the 'Intermediate Catch Message Event'.

Is this an expected behaviour? I would have thought that even in the second scenraio, when the instance is not sitting in a <WAIT> state, the client code should not get an error but instead the instance should get notified as soon as the instance arrives at the 'Intermediate Catch Message Event' step.

Surely, this request should get QUEUED and the instance should be notified when it arrives at the <WAIT>step.