cancel
Showing results for 
Search instead for 
Did you mean: 

Getting null while calling message intermediate catching event

dhayanidhypazha
Champ in-the-making
Champ in-the-making
Hi,

AS per the client request, we need to insert values to multiple tables in the same flow (more than 10 tables) so I created multiple service tasks- one for each table, Inorder to handle db issue i added error boundary event on each service task and calling a call activity (fault handling process) to handle the exception, once the error has been handled the call needs to go back to the same service task from where the issue occured - again to complete the insertion of values into the table. Inoreder to handle that scenario i created a sequence flow from service task to call activity and vice versa. Since multiple service tasks came into picture, the flow started looking confused so client asked me to go for different approach, so I created sequence flow from service task to call activity (fault handling process) and in call activity i created a java class with method to call back the service task through Message catching event and i added message catching event( intermediate event ) in the flow and created a sequence flow between message catching event and service task. But when i try to make a call from call activity to message catching event I am getting null exception. All the scenario exists in the same flow. Please find below the code I wrote to call message catching event.

public void Task6(DelegateExecution execution)throws Exception
{
try
{
System.out.println("Error boundary call");
EngineServices engineServices = execution.getEngineServices();
RuntimeService runtimeService = engineServices.getRuntimeService();
Execution messageExecution = runtimeService.createExecutionQuery().processInstanceId(execution.getProcessInstanceId()).messageEventSubscriptionName("MessageCatchEvent").singleResult();
System.out.println("messageExecution "+messageExecution ); —-> This returning null
runtimeService.messageEventReceived("MessageCatchEvent", messageExecution .getId() );
}
catch(Exception e)
{
e.printstacktrace();
}
}

+++++++System.out.println("messageExecution "+messageExecution );+++++ —-> This returning null

and the name of the message catching event is "MessageCatchEvent".
Please help me out in fixing the issue.

Thanks and Regards
Dhayanidhy P.

1 REPLY 1

trademak
Star Contributor
Star Contributor
Can you create a unit test that shows this issue?
That makes it easier for us to look into it.

Best regards,