cancel
Showing results for 
Search instead for 
Did you mean: 

Querying Message Intermediate Catching Event

gokceng1
Champ in-the-making
Champ in-the-making
Hi,
I've written an util method that get a DelegateExecution instance like JavaDelegate.execute(). I know there is a intermediateCatchEvent that waits for a message but I don't have the info about message name. I know also that the execution is waiting at that activity(I mean intermediateCatchEvent). How can I find the message name which intermediateCatchEvent is waiting for?
At that point when I called:

runtimeService.createExecutionQuery().processInstanceId(processInstance.getProcessInstanceId()).list()
or
((ExecutionEntity)runtimeService.createExecutionQuery().processInstanceId(processInstance.getProcessInstanceId()).singleResult())

I get 1 process instance, it doesn't give me any info about message subscription. I've tried
executionEntity.getEngineServices().getManagementService().createJobQuery().list()
but it gives nothing, I think it is only applicable to timer event, is that correct?

Thanks…
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
The job-query is only for timer-events, indeed. Messages are stored in the event-subscription-table. In our implementation, these can be queried when inside activiti-context, but it's not part of the public API:


List<EventSubscriptionEntity> eventSubscriptions = commandContext.getEventSubscriptionEntityManager()
      .findEventSubscriptionsByNameAndExecution(MessageEventHandler.EVENT_HANDLER_TYPE, messageName, executionId);

You can also use the BPMNModel (as of 5.12) or ReadonlyProcessDefinition (prior to 5.12) to get the activity-representation and inspect that to see what message-event definitions it has.

gokceng1
Champ in-the-making
Champ in-the-making
Thank you, I will try your suggestion.