Perform operations after executed CRUD operations for DbEntities


#1

Hi!
I need to perform operations after executing CRUD operations, in my case send kafka messages for some entities (e.g Task) after database commits
Is there a way?

Thanks in advance, best regards


#2

There are various ways:

  • You could implement a custom history event handler. Basically, every change in a process or task generates history events that you can listen to.
  • You can use task and execution listeners to listen for this kind of events. The camunda-bpm-reactor extension provides a convenient way to get notified of all those events in one place.

Edit: Note that both approaches do not inform you of every created entity (i.e. row in the Camunda database schema), but of the major business objects camunda creates, deletes, etc.


#3

Thanks for reply @thorben!

I agree for the history way :ok_hand:

I think I found a solution extending DefaultHistoryEventProducer performing each logical operations needed overriding the create event methods (e.g createTaskInstanceCreateEvt, createTaskInstanceCompleteEvt etc…)

Listener way is bound to bpmn parsing and sometimes preceding database operations

Thanks a lot, best regards