Receiving all active Sending Tasks- executions


i would like to receive all active executionIds of type “receiveTask” by a given processinstance - How can i archieve this? I need something like:

List<String> getAllWaitingExecutionsByProcessInstanceId(String processinstanceId)

Assuming the processInstance is not in a “receive task” wait state, the returned List should be empty.
If the processInstance is waiting in a “receive Task”, it should give me the executionId, of that receive-task.
If the processInstance is waiting in n "receive Task"s it should give me a List of execitionIds (relating to the receiveTasjs) of size n

Just for note: I need execution the execution Ids, because i want to access the defined local variables in that task.

How can i archieve this? It would be nice if you can give me a simple code example, or an idea how to bring this to work.

Thank you in advance :slight_smile:

best regards,

Hi Andy,

I think you can get there either via HistoryService#createHistoricActivityInstanceQuery and using its #activityType filter, or via RuntimeService#createEventSubscriptionQuery and its #eventType filter. The results of both have a getter called #getExecutionId.