6 Replies Latest reply on Jul 8, 2015 8:50 PM by Justin Bertram

    MDB Consuming messages from a remote queue

    Arnab Ghosh Novice

      Hi All,

       

      I am trying to configure an MDB to listen to a remote queue deployed on another instance of Wildfly 8.2.0

      The messaging sub system documentation: Messaging configuration - WildFly 8 - Project Documentation Editor suggests that a pooled connection factory can be used by an MDB to consume messages from the remote queue provided its configured correctly. I have added the below configurations:

       

      <netty-connector name="netty-remote-aoma-queue-server-connector" socket-binding="aoma-queue-server-socket"/>

       

      <pooled-connection-factory name="pooled-remote-connection-factory">

                              <transaction mode="xa"/>

                              <connectors>

                                  <connector-ref connector-name="netty-remote-aoma-queue-server-connector"/>

                              </connectors>

                              <entries>

                                  <entry name="java:/RemoteJmsXA"/>

                              </entries>

        </pooled-connection-factory>

       

      <outbound-socket-binding name="aoma-queue-server-socket">

                  <remote-destination host="host0309.server.systems.com" port="15455"/>

              </outbound-socket-binding>

       

      How should i configure the MDB to use this pooled connection factory ? Can you please point me to the correct activationconfig ?

       

      Regards

      Arnab

        • 1. Re: MDB Consuming messages from a remote queue
          Arnab Ghosh Novice

          Finally figured it out

           

          The change should be:

           

           

          !

          <pooled-connection-factory name="hornetq-ra">

                                  <transaction mode="xa"/>

                                  <connectors>

                                      <connector-ref connector-name="netty-remote-aoma-queue-server-connector"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:/JmsXA"/>

                                      <entry name="java:jboss/DefaultJMSConnectionFactory"/>

                                  </entries>

                              </pooled-connection-factory>

           

           

          Instead of adding a new pool, have to modify the existing hornetq-ra pooled factory,

          • 2. Re: MDB Consuming messages from a remote queue
            Justin Bertram Master

            Just noticed this thread...

             

            There's a couple ways to get an MDB to do what you want:

            • You can do what you did and change the default "hornetq-ra" pooled-connection-factory which will impact every MDB.
            • You can add a new pooled-connection-factory (e.g. "pooled-remote-connection-factory") and change the "ejb3" subsystem configuration to use that pooled-connection-factory either via XML or via the "ejb.resource-adapter-name" system property.  This will also impact every MDB.
            • You can use the @ResourceAdapter annotation to tell the MDB to use the "pooled-remote-connection-factory".  This will only impact the specific MDB which uses the @ResourceAdapter annotation.
            • 3. Re: MDB Consuming messages from a remote queue
              Arnab Ghosh Novice

              jbertram Thanks for your reply. I tried the tried the @ResourceAdapter approach. Got an exception. How will I define a new adapter for this new pool ? Can I just pass the pool JNDI name to the Adapter and it will work ?

              • 4. Re: MDB Consuming messages from a remote queue
                Justin Bertram Master

                What exception did you get?

                 

                I believe the @ResourceAdapter annotation takes the "name" of the <pooled-connection-factory> which in your case would be "pooled-remote-connection-factory" (as I noted in my previous comment).  You don't use the JNDI name.

                • 5. Re: MDB Consuming messages from a remote queue
                  Arnab Ghosh Novice

                  jbertram It worked. I was using the jndi name last time, hence the exception. Thanks for your help. Is there a place where the supported ActivationConfigs for an MDB in this scenario can be located ?

                  • 6. Re: MDB Consuming messages from a remote queue
                    Justin Bertram Master

                    Since the MDB is using the HornetQ JCA RA you can find the relevant information in the HornetQ documentation.