We’re using Camunda 7.13.
We have a custom HistoryEventhandler (“implements HistoryEventHandler”) in which we do some additional handling whenever a process instance is started. We start the process like this:
final Map<String, Object> params = new HashMap<>();
params.put("foo", 1);
runtimeService.startProcessInstanceById(id, businessKey, params)
And then, the engine calls the handleEvent-method in the handler:
@Override
public void handleEvent(final HistoryEvent historyEvent) {
Integer foo = (Integer) runtimeService.getVariable(historyEvent.getProcessInstanceId(), "foo");
}
Here, “foo” is null because there are no variables saved in the process instance (runtimeService.getVariables(historyEvent.getProcessInstanceId() returns an empty list). This worked flawlessly with 7.12 and earlier versions. It also seems not to happen all the time, but in 9 out of 10 cases.
Any suggestions?