Camunda CDI event Bridge vs BPMN Parse Listener

Good morning,

I’d like to send the processInstances’s variables to elasticsearch on every milestone that has been executed, and I thought about using Camunda CDI event bridge. I can detect the events that I want and perform that indexation. The problem is that I cannot use it on Camunda Unit tests, I tried it but I don’t get the listeners triggered on my tests.

Then I saw the BPMN Parse Listeners, which behaviour looks similar to cdi events bridge to me… Are these two ways intended to be used for different goals? Is it easier to perform tests with Parse Listeners? Or is it any of them becoming obsolete?

So far I managed it to work with CDI events bridge but my problem is how to get them to work with unit tests, or at least knowing if it’s possible or not.

Thanks in advance,
Alfonso.

Hi @alfmateos,

the CDI eventing bridge needs a CDI environment which usually comes with an JEE Server. JUnit test start a plain Java environment without CDI support.

You could move to integration tests with Arquillian in your tests.

Or try the configuration with an embedded engine as mentioned in the first box here: https://docs.camunda.org/manual/7.13/user-guide/cdi-java-ee-integration/the-cdi-event-bridge/.

I think the CDI event bridge is just another (more abstract way) to fulfill the same purpose. Personally I don’t like the programming with annotations, my preference is the old school programming with a parse listener to configure the listeners in the engine. And this will work in Junit as well.

Hope this helps, Ingo