8 Replies Latest reply on Nov 16, 2016 10:51 PM by Cool Smart

    Help - wildfly 10 for messaging

    user_77 dev Newbie

      This is my first attempt to use jms. My requirement is to have sender and receiver seperately in 2 different wildlfy-10.0.0-final servers in different machines.

       

      I tired a simple standalone classes using following config.

       

      In sender & receiver class

      ============================

      connection factory : jms/RemoteConnectionFactory.

      url : http-remoting://localhost:8080

       

      standalone-full.xml subsystem:

      =============================

      queue: queue name prefixed with java:jboss/exported

      <socket-binding name="remoting" port="${jboss.http.port:8080}"/>

       

       

      however it works fine in stantalone, but the same when i implement in spring I was unable to start-up the consumer server(but able to send message).

      Error says bean defition not found for the queue, though I declared queue prefixed with export in both standalone-full.xml.

       

      1. wht am i doing wrong and how should i approach it considering best practice?

      2. In some examples i have seen using resource adapter, for both embedded and out of process activemq in wildfly. activemq is already available in wildfly why i need a resource adapter.

       

       

      Thanks in advance.

        • 1. Re: Need urgent help - wildfly 10 for messaging
          Justin Bertram Master

          Couple of things:

          1. Your use-case isn't quite clear to me.  You appear to have two instances of Wildfly running (e.g. A and B) and a JMS client running in instance.  One of the JMS clients is a message producer and the other is a consumer.  Is all of that correct?  If so, I assume that the consumer needs to receive the messages from the producer.  If that's true then one of your clients can use local resources while the other uses remote resources.  For example, the message producer can send to the local broker and the consumer can reach across the network and consume those messages or vice-versa.  Both clients don't need to use remote resources.
          2. If you're having trouble with bean definitions that's almost certainly a Spring issue and not a Wildfly/messaging issue.
          3. Clients running in the application server (i.e. Wildfly) can leverage the resource adapter for simpler configuration and better performance, but it isn't required.
          • 2. Re: Need urgent help - wildfly 10 for messaging
            user_77 dev Newbie

            Thank u for the reply justin. You are correct!. Once again I want to say it clearly..

            Requirement: 2 wildfly instance A and B. Once sends messages to queue (i.e A). The remote wildfly B uses the A's ip address in the url to connect and consumes the msgs from queue. if remote goes down(ie B) still A can send msgs to queue. When ever  the consumer server(B) is started up, it process the msgs from queue.

             

            I have already achieved it using spring's embedded activemq broker. Created queue with same name in both app A and B and its working as expected. But now I want to use the broker available in wildfly server.

             

            Doubts: Things which are not clear to me is the queue. should I need to create queue with same name in both server A and B? If s how the msgs are copied to the queue in server B?

             

            I have seen the resource adapter configuration, as u mentioned its simpler and understandable. but I don't know how to configure it.

             

            Thanks again..

            • 3. Re: Need urgent help - wildfly 10 for messaging
              Justin Bertram Master

              should I need to create queue with same name in both server A and B?

              Creating the same queue in 2 places indicates that there would be 2 different messaging brokers running and that's really not necessary.  You only need 1 messaging broker and 1 queue running on Wildfly instance A.  The application running on Wildfly instance A would send messages to the queue running on the local messaging broker.  The application running on Wildfly instance B would reach across the network to the messaging broker running on Wildfly instance A and retrieve those messages.

               

              If s how the msgs are copied to the queue in server B?

              In this scenario messages would not be copied to server B.  They would simply be retrieved by the application running on Wildfly instance B from the queue on the messaging broker running on Wildfly instance A.  If you really wanted to copy the messages across the network that could be configured, but it would require 2 messaging brokers each with their own queue which, along with the copying process, would waste resources and negatively impact performance.

               

              I have seen the resource adapter configuration, as u mentioned its simpler and understandable. but I don't know how to configure it.

              I would encourage you to get the simple use-case working first and then if necessary you can use the resource adapter.

              1 of 1 people found this helpful
              • 4. Re: Need urgent help - wildfly 10 for messaging
                user_77 dev Newbie

                Hi justin, I just tried a sample standalone sender n receiver by following the reference.

                 

                "How to connect to a remote queue in JBoss AS 7 ? « JBoss"

                 

                All i did is.. made a queue entry in standalone-full.xml and to access it (queue in server A) in the remote changed the following.

                 

                <interface name="public">

                            <inet-address value="${jboss.bind.address:0.0.0.0}"/>

                </interface>

                 

                Now could u please clarify the following doubts..

                 

                1.    For the provider url I have given http-remoting://localhost:8080. I am unable to change it to 4447/61616, exception occurs.

                "main" javax.naming.CommunicationException: Failed to connect to any server. Servers tried: [http-remoting://localhost:61616 (java.net.ConnectException: Connection refused: no further information)]

                    at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:244)

                    at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)

                    at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)

                    at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)

                    at org.jboss.naming.remote.client.RemoteContext.lookupInternal(RemoteContext.java:104)

                    at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:93)

                    at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:146)

                    at javax.naming.InitialContext.lookup(Unknown Source)

                    at sender.QueueSend.init(QueueSend.java:39)

                    at sender.QueueSend.main(QueueSend.java:69)

                 

                    Is there any way that I could change the jms messaging port?

                 

                2.   Also give me some ideas/ references for connection pooling.

                 

                Thank you.

                • 5. Re: Need urgent help - wildfly 10 for messaging
                  Justin Bertram Master

                  For the provider url I have given http-remoting://localhost:8080. I am unable to change it to 4447/61616, exception occurs.

                  Why do you want to change the port?  Wildfly supports multiple components on a single port so you should just be able to use the default 8080.

                   

                  Also give me some ideas/ references for connection pooling.

                  Essentially you just need to create a pooled-connection-factory in the same JVM as your application that will connect to wherever you need and then you use that connection factory from your application.  If you're producing messages then you can use the pooled-connection-factory directly.  However, if you're consuming messages you'll need to use an MDB or some other JCA-based consumer.

                  • 6. Re: Help - wildfly 10 for messaging
                    Cool Smart Newbie

                    Hi Justin ,

                     

                    I developed a web application with JMS. When I send message I can received it in MDB using Queue. My problem is my system used by many users when need to send a message to particular user , How can I do that ? Previously I used PushNotification primeface component.In Primface component I use Channels to filter users. Now I need to change it using JMS and MDB. I am new to this. And another one that i need to keep all message when user in offline too. Whenever they came to online the messages should sow to them. I am using JSF, Hibernate and EJB.

                     

                    Thanks in advance !   

                    • 7. Re: Help - wildfly 10 for messaging
                      Justin Bertram Master

                      This thread is already marked as answered by the original author.  Please don't hijack other people's threads.  I'll deal with your question on its thread at How To create JMS Queue and MDB to handle Multi Users ?

                      • 8. Re: Help - wildfly 10 for messaging
                        Cool Smart Newbie

                        okay Thank you.