Hi Stephen,
I think this will be hacky anyway as it uses internal API heavily. That said, one improvement could be using the engine’s configured history handler instead of always instantiating a new one. You can find it via execution#getProcessEngineConfiguration
(confer class ProcessEngineConfigurationImpl
). Another idea is to ask the engine’s history level if this event should be produced before giving it to the handler.
Cheers,
Thorben