4 Replies Latest reply on Oct 16, 2015 5:58 PM by Matthieu Brouillard

    MDB not intercepted when annotation is put dynamically

    Matthieu Brouillard Newbie

      Hi,

       

      I have an issue with CDI and MDBs.

      I have a CDI extension that dynamically add an interception annotation to managed beans. Unfortunately on MDBs the intercptor is not called.

       

      In the provided/attached project I have simplified as much as I could the example, can someone confirm that it is a bug, I'll then open a JIRA.

       

      Example description:

      • it is a maven based project
      • it requires a local Wilfly installation running on standard ports
      • using cli create the expected queue:

      /subsystem=messaging/hornetq-server=default/jms-queue=LoggerMessages/:add(entries=["java:/queue/Logger/messages"])

      • execute arquillian test

      mvn verify -DUSER_NAME=adminuser -DUSER_PASSWORD=adminpassword


      In the example, a MDB (that should be intercepted) when receiving a message delegates stuff to an EJB (that should be intercepted).

      The test, send a message to the MDB queue and verifies that there were 2 interceptions.


      Currently it fails because only the stateless has been intercepted.

      If instead of putting the annotation dynamically with the extension you set it directly on the MDB & on the Stateless (and deactivate the extension) then the test works.

       

      It looks like only dynamicaly set annotations are not taken into account on MDB.

       

      Can someone confirm the problem?

       

      Thanks.

       

      Update:

      I added a version of the project that is git enabled with 2 tags:

      • dynamic: interception annotation are put dynamically by the CDI extension and the test fails
      • static: interception annotation are put directly on the classes, the extension is deactivated and the test succeeds