Business key in IncidentHandler

Hi,

I am creating my own incident handler, extending the default one. In addition to create the incident in Camunda, I want to send a message to another service. This message must contain the business key.
The business key is not in the IncidentContext object.
How can I retrieve it?
I tried to use runtimeService to query the Camunda engine, but Spring refused to instantiate my IncidentHandler for circular dependencies reasons (I assume the runtimeService depends on IncidentHandler).

I had a look at the DefaultIncidentHandler code. So I could try to retrieve the Execution like this

ExecutionEntity execution = Context
        .getCommandContext()
        .getExecutionManager()
        .findExecutionById(context.getExecutionId());

Because ExecutionEntity is in a “impl” package, I am not sure this is a good way to get it.

Thanks,

Alain

Getting the execution by command context is fairly well used throughout the code (including, as you mentioned, DefaultIncidentHandler). While not optimal, findExecutionById may return ExecutionEntity for legacy reasons at this point. I couldn’t find a better way to retrieve what you’re looking for.

OK, thank you.