I did a further research and I think, what I am supposed to use is a custom HistoryEventHandler.
Because what I am trying to achieve is to save all variables to a history database. However, when I am implementing my custom HistoryEventHandler I don’t have access to the variables.
public class CustomHistoryEventHandler implements HistoryEventHandler {
@Override
public void handleEvent(HistoryEvent historyEvent) {
}
I understand I have to cast the historyEvent to a appropriate child event. However, I do not find any child class that grants me access to the submitted variables. For example, casting to HistoricTaskInstanceEventEntity will grant me access to assignee, due date, etc. but not to variables.
Furthermore, extending HistoryEventHandler will result in camunda not writing events to the camunda history table. The docs state that instead one should use CompositeHistoryEventHandler
(History and Audit Event Log | docs.camunda.org) But I don’t find an example for CompositeHistoryEventHandler either. In this thread, it was already mentioned that there is no Documentation: External provider for history audit log in Spring Boot - #6 by Niall