@mns For spring applications, camunda.cfg.xml file not required. You can provide configurations in application.yml or spring java configuration.
By default, the Spring eventing is enabled by a engine plugin.
In application.yml,
camunda:
bpm:
eventing:
execution: true
task: true
history: true
On the execution event stream,
DelegateExecutions (mutable) andExecutionEvents (immutable) can be received. The task event stream offersDelegateTasks (mutable) andTaskEvents (immutable). On the history event stream, onlyHistoryEvents (mutable) are published.
@Slf4j
@Component
public class CamundaEventListeners {
@EventListener
public void onTaskEvent(DelegateTask taskDelegate) {
log.info("Handling mutable DelegateTask:{}", taskDelegate.getTaskDefinitionKey());
}
@EventListener
public void onTaskEvent(TaskEvent taskEvent) {
log.info("Handling immutable TaskEvent:{}", taskEvent.getTaskDefinitionKey());
}
@EventListener
public void onExecutionEvent(DelegateExecution executionDelegate) {
log.info("Handling mutable DelegateExecution:{}", executionDelegate.getCurrentActivityName());
}
@EventListener
public void onExecutionEvent(ExecutionEvent executionEvent) {
log.info("Handling immutable ExecutionEvent:{}", executionEvent.getProcessDefinitionId());
}
@EventListener
public void onHistoryEvent(HistoryEvent historyEvent) {
log.info("Handling mutable HistoryEvent:{}", historyEvent.getEventType());
}
}
Verify the below logs (line 2 & 3 for onExecutionEvent() ):
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:start
c.e.w.events.CamundaEventListeners : Handling mutable DelegateExecution:Start
c.e.w.events.CamundaEventListeners : Handling immutable ExecutionEvent:ProducerProcess:3:9daed8ea-dcbe-11ea-a69c-507b9dc4ed46
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:start
c.e.w.events.CamundaEventListeners : Handling mutable DelegateExecution:Start
c.e.w.events.CamundaEventListeners : Handling immutable ExecutionEvent:ProducerProcess:3:9daed8ea-dcbe-11ea-a69c-507b9dc4ed46
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:end
c.e.w.events.CamundaEventListeners : Handling mutable DelegateExecution:Start
c.e.w.events.CamundaEventListeners : Handling immutable ExecutionEvent:ProducerProcess:3:9daed8ea-dcbe-11ea-a69c-507b9dc4ed46
c.e.w.events.CamundaEventListeners : Handling mutable DelegateExecution:Start
c.e.w.events.CamundaEventListeners : Handling immutable ExecutionEvent:ProducerProcess:3:9daed8ea-dcbe-11ea-a69c-507b9dc4ed46
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:start
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:create
c.e.w.events.CamundaEventListeners : Handling mutable DelegateExecution:Producer
c.e.w.events.CamundaEventListeners : Handling immutable ExecutionEvent:ProducerProcess:3:9daed8ea-dcbe-11ea-a69c-507b9dc4ed46
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:add-identity-link
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:create
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:update
c.e.w.events.CamundaEventListeners : Handling mutable DelegateTask:Activity_15yh7ii
c.e.w.events.CamundaEventListeners : Handling immutable TaskEvent:Activity_15yh7ii
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:update
c.e.w.events.CamundaEventListeners : Handling mutable DelegateTask:Activity_15yh7ii
c.e.w.events.CamundaEventListeners : Handling immutable TaskEvent:Activity_15yh7ii
c.e.w.events.CamundaEventListeners : Handling mutable HistoryEvent:update
All the events are triggered properly.