Query deadletter queue with businessKey

Continuing the discussion from How to avoid all activities to be rolled back on Flowable Exception:

Hi,

@joram said:

The deadletter job has executionId, processInstanceId and processDefinitionId

Is there a way to query the deadletter queue with a businessKey?
If no, how can we achieve that? By looking in the runtime/history the mapping between businessKey and processInstanceId?
When the process goes to the deadletter queue, is it removed from the runtime? Is it in the history?

Thanks,
Michel

Hey @mykeul,

No there is no way to query the deadletter jobs with a businessKey.

A process does not go to the deadletter queue, a job goes. The process stays in the runtime and the history.

The runtime tables contain a subset of the history tables (unless you have disabled history).

Cheers,
Filip

Thank you @filiphr
So I can retrieve the processInstanceId by querying the runtimeService with the businessKey, then checking the deadLetterQueue to see if a job with such id exists there.
My goal is to reply to clients that ask for process status and I want to check that the process is not in an error state.
Thanks.

Yes you can do this.

This makes a lot of sense. You could achieve this with what you proposed.

Cheers,
Filip

Perfect. Thanks a lot Filip.