Identify whether token is ready for correlation

Dear Members,
I’ve started using Camunda in one my projects where I’m using it as a process orchestrator. I’m using Community version 7.14.0 and running process engine in microservice mode (4 pods in k8s).
While correlating a receive task, I want to see if the token is present at the task. To achieve this I think there are two options available as per documentation.
(1) Identify through activity instance query (get process instance id from business key and use it to get activity instances of that process instance)
(2) Identify through subscription query (get process instance id from business key and use it to get subscriptions of that process instance)
My question is -
(1) Which if the above is the correct method to definitely identify the presence of a token at a receive task
(2) If both are correct, which one is more efficient (w.r.t. time it takes)
(3) Is there any other (better) method than this which may give me more efficient result

Note: I’m using unique business key for each process instance

Thank you for your valued suggestions.

Soumik Ray

Hi @mtq0205,

Event subscription query is the correct way in which you can query by event type “message” and event name “<MESSAGE_NAME>”.

Using activity instance query, you can’t query by event name.

Messages can be correlated only when event subscriptions are created.

Thank you very much for the valuable guidance.

1 Like