0 Replies Latest reply on Apr 25, 2013 2:42 AM by Arjun A

    help needed in configuring  JMS remote consumer using <pooled-connection-factory>

    Arjun A Newbie

      Hi all,

       

      I have 2 Maven project, JMSProducer and JMSConsumer which will be packaged as ' war ' and will be deployed in JBOSS AS 7.1.1 Final.

       

      JMSProducer is running in one machine say machine A, which will be posting messages to a queue in machine A.

      JMSConsumer is running in machine B which consumes messages from the remote queue of machine A.

       

       

      my JMSProducer

       

      public class QueueProducer {

        

          @Resource(mappedName = "java:/ConnectionFactory1Mgmt")

          ConnectionFactory connectionFactory;

       

          @Resource(mappedName = "/queue/testJMS")

          Queue queue;

       

          private Connection connection;

       

          public void sendMessage() {

               try {

       

                 new InitialContext();

                  this.connection = this.connectionFactory.createConnection();

                  Session session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                  MessageProducer publisher = session.createProducer(this.queue);

                  TextMessage textMessage = session.createTextMessage("hello world");

                  this.connection.start();

                  publisher.send(textMessage);

                  this.connection.close();

                  session.close();

       

              } catch (JMSException jmse) {

                  jmse.printStackTrace();

       

              } catch (NamingException ne) {

                  ne.printStackTrace();

              }

       

          }

       

      }

       

      in machine A standalone-full xml i configured

       

      jms queue configuration

      <jms-queue name="testJMS">

                              <entry name="queue/testJMS"/>

                              <entry name="java:jboss/exported/jms/queue/testJMS"/>

      </jms-queue>

       

       

       

      My JMSConsumer

       

       

      @ResourceAdapter("ConnectionFactory1Mgmt")

      @MessageDriven(activationConfig = {

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

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testJMS")

      })

       

       

      in machine B standalone-full.xml

       

      <connectors>

               <connector name="remote-jms-nonmgmt">

                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                       <param key="host" value="remotehost"/>

                       <param key="port" value="5445"/>

               </connector>

               <netty-connector name="remote-jms-mgmt" socket-binding="remote-jms-binding"/>

      </connectors>

       

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

               <user>jmsuser</user>

               <password>jmspwd</password>

               <connectors>

                       <connector-ref connector-name="remote-jms-mgmt"/>

               </connectors>

               <entries>

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

               </entries>

      </pooled-connection-factory>

       

      i create a application user in machine A with roles as guest.

      Is my understanding correct?. What configuration i have to use in producer side (machine A) for connection factory - ConnectionFactory1Mgmt . 

       

      Thanks in advance