5 Replies Latest reply on Jun 28, 2013 10:19 AM by jaikiran

    MDB, ActiveMQ and @ResourceAdapter (seems that anotation is not taken into account)

    rssole

      Hi, hopefully someone will be able to shed some light if I am doing something wrong?

       

      I have deployed ActiveMQ res.adapter to JBoss AS7 (7.1.1. "Brontes" - standalone, messaging subsystem enabled) and configured it (other config omitted for brewity):

       

      <admin-objects>
           <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:/queue/AlertQueue" use-java-context="true" pool-name="alertQueue">
                <config-property name="PhysicalName">alertQueue</config-property>
           <admin-object>
      </admin-objects>
      

       

      And that works quite OK, verified by deploying some web app with queue bound via @Resource.

       

      Next, I didn't specify resource adapter in <mdb> element of ejb configuration there is hornetq-ra as it is by default.

       

      Next I've deployed MDB (well, tried to) defined as follows:

      @MessageDriven(name = "ActiveMQBoundMessageDrivenBean") //, activationConfig = {
            @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
            @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/AlertQueue"),
            @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")}) // later I've moved activation config moved to ejb-jar.xml
      @ResourceAdapter("activemq-rar-5.8.rar")
      public class ActiveMQBoundMessageDrivenBean implements MessageListener { ...
      
      

       

      Error message I could see in console was indicating that MDB is trying to find AlertQueue using default resource adapter from <mdb> and not one
      specified in annotation.

       

      I've looked around and found this: https://community.jboss.org/message/715192 where Justin Bertram suggests jboss-ejb3.xml as option.
      So I've added it with following content:

       

      <jee:assembly-descriptor>
         <mdb:resource-adapter-binding>
            <jee:ejb-name>ActiveMQBoundMessageDrivenBean</jee:ejb-name>
            <mdb:resource-adapter-name>activemq-rar-5.8.rar</mdb:resource-adapter-name>
         </mdb:resource-adapter-binding>
      </jee:assembly-descriptor>
      

       

      And that works indeed... but I couldn't figure out why annotation has not been processed at all?


      Am I missing something? Any tip/suggestion/advice is welcome and appreciated.

       

      Thanks in advance,
      R.