Hi,
Is it possible to create a engine plugin to add listeners on all process instances’ start/complete event?
Hi @xuesong_yang,
Here’s an example that shows how to programmatically register an execution listener for a certain type of element: https://github.com/camunda/camunda-bpm-examples/tree/master/process-engine-plugin/bpmn-parse-listener
You can adapt it to register a listener on process start/end.
Cheers,
Thorben
Thanks, It helps a lot.
One more question:
In this simple process’s end execution event listener(DelegateListener#notify(ExecutionEntity entity)), I can NOT query out current HistoricProcessInstance by ExecutionEntity#getProcessEngineServices()#getHistoryService()#createHistoricProcessInstanceQuery()
#processInstanceId(#ExecutionEntity#getProcessInstanceId())#singleResult(). It’s because there is no safepoint to save process state into DB before reach the end event. What I can query out is current ProcessInstance object, whose type is ExecutionEntity. But it does NOT contains #getStartTime and #getStartUserId methods(while the HistoricProcessInstance has). How can I obtain process startTime under this circumstance.
Thanks in advance.