3 Replies Latest reply on Dec 2, 2015 2:24 PM by clymbon

    Using JNDI name for ActiveMQ queue in MDB?

    hwellmann.de

      I've set up JBoss AS 7.1.3 to work with a stand-alone ActiveMQ 5.7.0 broker, following the instructions in

      https://community.jboss.org/wiki/JBoss6EAPOr7xxToApacheActiveMQ56Or7

       

      So far, the only way I could get MDBs to work is by using the physical queue name as destination, but I'd like to use the JNDI name to decouple my application from actual queue names in a given deployment. Is there a way to achieve that?

       

      Here is my queue definition in the resource adapter configuration:

       

      {code:xml}

                          <admin-object class-name="org.apache.activemq.command.ActiveMQQueue" jndi-name="java:jboss/exported/jms/queue/jboss-test" use-java-context="true" pool-name="jboss-test">
                              <config-property name="PhysicalName">
                                  jboss-test
                              </config-property>
                          </admin-object>

      {code}

       

      And this is the MDB:

       

      {code}

      @MessageDriven(

      activationConfig = {

        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true"),

        @ActivationConfigProperty(propertyName = "destination", propertyValue = "jboss-test")

      })

      public class JmsQueueConsumer implements MessageListener {

         ...

      }

      {code}

       

      The sample does not work when setting the destination property to jms/queue/jboss-test. Any ideas...?

       

      Best regards,

      Harald