What's the difference between ActivatedJob's key and Job's elementInstanceKey?

What’s the difference between ActivatedJob's key and Job’s elementInstanceKey?

Sometimes they share the same value, but sometimes they differs a lot. It confuses me a lot. I just don’t know use which key to fail/complete job or set variables.

Appriciate for explaination.

Please have a look at the docs: https://docs.zeebe.io/reference/grpc.html#output-activatejobsresponse
And https://docs.zeebe.io/clients/java-client-examples/job-worker-open.html

The key of the ActivatedJob identifies the job. Use this key to send the complete or fail job command.

The elementInstanceKey identifies the element instance related to the job. You can use the elementInstanceKey to update variables of the workflow instance. Or, use the workflowInstanceKey to set a variable on the root scope of the workflow instance.

Does this answer your questions?

1 Like