5 Replies Latest reply on Jul 5, 2012 11:01 AM by Justin Bertram

    MDB in Jboss AS 7- Queue/Topic  Mapping

    Bashir Wichka Newbie

      I like to create a mapping of the queue for MDB in Jboss 7. My MDB is as follows. I want to create a mapping from

      queue_key   to real_queue.   In Jboss 5 I used to do it using NamingAlias but since JMX beans are not supported in Jboss 7,

      I am wondering how can it be done in Jboss 7?

       

      @MessageDriven(name="ExampleMDB", messageListenerInterface=javax.jms.MessageListener.class, activationConfig =

      {

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

      @ActivationConfigProperty(propertyName="Destination", propertyValue="queue_key"),

       

      })

      public class ExampleMDB {

       

      }

       

      Thank you

      Bashir

        • 1. Re: MDB in Jboss AS 7- Queue/Topic  Mapping
          Justin Bertram Master

          You can set up a naming alias like this:

           

          <subsystem xmlns="urn:jboss:domain:naming:1.1">
              <bindings>
                  <!--  Following is used for Aliasing JNDI names -->
                  <lookup name="queue_key" lookup="real_queue"/>
              </bindings>
          </subsystem>
          

           

          Or you could just bind the queue to all the relevant JNDI locations, e.g.:

           

          <jms-destinations>
              <jms-queue name="myQueue">
                  <entry name="queue_key"/>
                  <entry name="real_queue"/>
              </jms-queue>
          </jms-destinations>
          
          • 2. Re: MDB in Jboss AS 7- Queue/Topic  Mapping
            Bashir Wichka Newbie

            Thank you for answering. Which subsystem contains  <jms-destinations>. I am NOT using hornet messaging and how will the MDB gets the hint that it has to lookup JNDI.

             

            Thanks,

            Bashir

            • 3. Re: MDB in Jboss AS 7- Queue/Topic  Mapping
              Justin Bertram Master

              The messaging subsystem (i.e. <subsystem xmlns="urn:jboss:domain:messaging:1.1">) contains <jms-destinations>.  Of course, this subsystem is reserved for HornetQ configuration so you won't be able to use <jms-destinations> if you are not using HornetQ.

               

              Could you clarify a few points?

              1. If you're not using HornetQ, what are you using?
              2. How are the MDBs consuming messages from a non-HornetQ destination implementation?  Did you change the default <mdb>/<resource-adaptor-ref> in <subsystem xmlns="urn:jboss:domain:ejb3:1.2">?

               

              As far as how the MDB gets the hit that it has to lookup the destination in JNDI, that will depend on the JCA resource adapter which the MDB is using.  to be clear, the HornetQ JCA Resource Adapter looks in JNDI by default and then falls back to the HornetQ "core" API to find the destination if JNDI doesn't work.

              • 4. Re: MDB in Jboss AS 7- Queue/Topic  Mapping
                Mohammad wrk Newbie

                Here is my configuration:

                 

                                <jms-destinations>

                                    <jms-queue name="testQueue">

                                        <entry name="jms/queue/test"/>

                                    </jms-queue>

                                </jms-destinations>

                 

                And this is the Java code to inject the queue into an EJB:

                 

                @Resource(lookup="jms/queue/test")

                private Queue testQueue;

                 

                The ony way I can get this code working on Jboss 7.1 is to add "java:/" to the lookup attribute value! However the same code with a similar configuration works fine on Websphere 8.

                Am I missing something here or this is a bug?

                • 5. Re: MDB in Jboss AS 7- Queue/Topic  Mapping
                  Justin Bertram Master

                  Your issue doesn't appear to be related to the main purpose of this thread.  Please create a new thread about your issue.