Using asyncHistory

Is there a way when man enabled and activated asyncHistory feature and still get process history Variable Instance immediately by createHistoricVariableInstanceQuery() after process finished?

Hi Tommy,

Yes, you can create some listener at the end event and process all history events from the queue (as jobs) You can execute them synchronously, so process is not finished till all updates are not done.

This proposal is quite strange. I would need more info to propose something more meaningful.

Regards
Martin

Thanks for reply. I need to get some process variables immediately once process finished or a personal user task completed. before i enable the asyncHistory, i can always get them by createHistoricVariableInstanceQuery. but when i turn on the asyncHistory feature. i noticed some history data is not to be persisted in the default history table immediately . so i can not get those process variables by createHistoricVariableInstanceQuery everytime (sometimes works).

Async history is, as the name implies, asynchronous and thus ‘eventual consistent’. If you need the variable just before the end, the best way forward is indeed as @martin.grofcik mentions with an execution listener that fires just before ending the process and sending them somewhere you can retrieve them later.

What’s the use case for using async history? If this functionality is important to you, running it with the default sync history gives you exactly what you need.

That’s expected behavior. If you want to get variables immediately you can call the process as subprocess and fetch variables in the parent process from the runtime (or memory)

Regards
Martin