How to query the count of activity instances waiting at an intermediate catching event

Hi folks,

for some reason i need to get the count of activity instances waiting for the event correlation at an intermediate catching event in the context of multiinstance.

Under RuntimeService i have only found something like getActivityInstance, as the doc explained, this represents a activity instance(tree), but in the interface ActivityInstance there are only methods to get the child activityInstances but none for parent. I don’t actually understand it, without parent activity instance how could i get other instances at the same level?


Hi @fjiang,

you can use the following query to count your executions:

// or
// add more criteria, e.g. processInstanceId(processInstanceId)

Does this help you?

Best regards,

1 Like

Hi Philipp,

thanks for your reply! I prefer the first suggestion, but “intermediate-catch-event” isn’t an activityId but activity type. If it’s possible to query the activity type?


No, you can only query by the id of the activity. In my snippet, this should be an id.

Hi Philipp,

in other words, how can i get the current running activity’s type?

And if i use the activityId, by the following snippet which id should i use, the name or the id?

<bpmn:intermediateCatchEvent id=“IntermediateCatchEvent_00xioei” name=“PROVISIONING: Receive response”>
<bpmn:messageEventDefinition messageRef=“Message_0ew3wjw” />

You should use the id as the activity id -> IntermediateCatchEvent_00xioei.

You can get the type of an activity using the BPMN model API.
If you want to query by activity type then you can use the History Service HistoricActivityInstanceQuery.