0 Replies Latest reply on Jun 6, 2014 12:07 PM by jefoy1101

    remote JMS Queue using Jboss 7.1.1 Final

    jefoy1101

      Good Day I would just like to ask some help / clarification as well, I've already been to the following link

       

       

      "Failed to create session factory"  from client connecting to jboss-as7 hornetq

      [HORNETQ-952] When binding AS to 0.0.0.0 remote HornetQ clients fail - JBoss Issue Tracker

      https://issues.jboss.org/browse/JBPAPP-9393

       

      May I ask how do you do JMS Queue remoting on JBOss 7.1.1.Final

      I'm using RemoteConnectionFactory in my connection

      Do I need to bind my remote(172.45.45.45) jboss server to a specific IP address in order to connect to it remotely? Like passing a –b IPAddress upon starting jboss?

      or configuring it on standalone.conf like this

      And in remote IP /jboss/bin/standalone.conf (do I really need this?)

      # set this value so we can send JMS messages from remote clients

      JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=172.45.45.45”

       

       

      Here is a scenario I wanted to send a JMS message to my Queue in my local laptop, I have a publisher for my queue and on 172.45.45.45 (remote ip) web.war() is deployed in that remote IP and  I have my consumer  configured to this queue

       

          <jms-queue name=“testqueue">

                              <entry name="java:jboss/queue/mss/testqueue"/>

                              <durable>true</durable>

                          </jms-queue>

       

      I have configured my Jboss application user with the guest role

      I have my queue config in standalone.xml(copy of standalone-full.xml)

      I have my JMS publisher/consumer

       

       

      If I have the following config below, sending JMS message remotely is working fine. Without that I’m getting a error=2 cannot connect to server(s)

       

      my local etc/hosts config for that IP  (do I really need this?)

      172.45.45.45     ip-172-45-45-45.ec2.internal

       

      remote Jboss server config

      And in remote IP /jboss/bin/standalone.conf (do I really need this?)

      # set this value so we can send JMS messages from remote clients

      JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=172.45.45.45”

       

       

      BTW i followed this tutorial

      http://theopentutorials.com/examples/java-ee/ejb3/remote-jms-client-and-ejb3-mdb-consumer-eclipse-jboss-7-1/

       

      Need help on implementing JMS queue remotely without the following configuration

      my local etc/hosts config for that IP  (do I really need this?)

      172.45.45.45     ip-172-45-45-45.ec2.internal

       

      remote Jboss server config

      And in remote IP /jboss/bin/standalone.conf (do I really need this?)

      # set this value so we can send JMS messages from remote clients

      JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=172.45.45.45”

       

       

      Here is the Code snippet for my JMS Publisher

       

      private static String username = "testuser";

      private static String password = "testpass";

      private static String host = "remote://172.45.45.45:4447";



      Properties jndiProps = new Properties();

        try {

        jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

        jndiProps.put(Context.PROVIDER_URL, host);

        jndiProps.put(Context.SECURITY_PRINCIPAL, username);

        jndiProps.put(Context.SECURITY_CREDENTIALS, password);

       

        Context context = new InitialContext(jndiProps);

        ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("jms/RemoteConnectionFactory");

        connection = connectionFactory.createConnection(username, password);

        topic = (Topic) context.lookup("jms/topic/testTopic");

        System.out.println("Connected to JMS");

        connection.start();

       

       

       

      Sample Code snippet from my Consumer

       

      /**

      * Message-Driven Bean implementation class for: MDBSample- This is for Consume the Queue

      */

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

      @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/test"),

      @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})

      public class MessageConsumer implements MessageListener {

       

          /**

           * Default constructor.

           */

          public MessageConsumer() {

       

          }

       

          /**

           * @see MessageListener#onMessage(Message)

           */

          public void onMessage(Message message) {

         

              try {

               ObjectMessage msg = (ObjectMessage) message;

               JMSMessage jmsMessage = (JMSMessage) msg.getObject();

                  System.out.println("Received message is ==========> " + jmsMessage.getAction());

              } catch (JMSException e) {

       

                  e.printStackTrace();

              }

       

          }

       

      }