6 Replies Latest reply on Apr 8, 2014 12:07 PM by Justin Bertram

    MDB is not consuming Messages from Queue on standalone Hornetq

    karna spartacus Newbie

      i am using wildfly-8.0.0.Final and hornetq-2.4.0.Final.  

      I'm trying to read messages from queues on hornetq server using MDB. my MDB is running on wildfly.  

       

       

      First i removed all messaging configuration from standalone.xml(wildfly).In hornetq-2.4.0.Final, i added my queue in hornetq-jms.xml. 

       

      In my MDB, I gave

       

          @MessageDriven(activationConfig = {

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

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

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

           @ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),

        @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=localhost;port=5445")})

          @ResourceAdapter("hornetq-ra.rar")

       

       

       

       

      Then i started both servers(wildfly,hornetq), hornetq server started smoothly but in wildfly while deploying MDB(M2MEventDistributor), it threw error as,

       

       

              JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "M2MEventDistributor.jar")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"M2MEventDistributor.jar\".component.M2MEventDistributorMDB.CREATE is missing [jboss.ra.hornetq-ra]"]}

       

       

      and

       

       

              2014-04-04 13:32:29,042 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1)JBAS014774: Service status report

           JBAS014775:    New missing/unsatisfied dependencies:

            service jboss.ra.hornetq-ra (missing) dependents: [service jboss.deployment.unit."M2MEventDistributor.jar".component.M2MEventDistributorMDB.CREATE]

       

       

      I found that the issue is with hornet-ra adapter,

      I searched in internet about this issue and referred links and followed instructions in them, but hard luck, nothing helped me. 

       

       

      Everyone in net, forums, blogs, and communities are saying about deploying hornetq-ra.rar and changing the ra.xml file in that rar file. In wildfly i didn't even find any clue about hornet-ra.rar and ra.xml. But i found hornet-ra-2.4.1.Final.jar in wildfly modules then i added that jar to MDB classpath and also mentioned in the jboss-deployment-structure.xml file. Then also i'm getting the same error.

       

       

      And then i followed this link https://community.jboss.org/message/756775 , and tried steps which are given by andy taylor except things regarding hornet-ra.rar and ra.xml file, because i don't know where  i have to find them.

       

       

      Then my MDB got deployed but not consuming messages from the queue. in log i found one line,

       

       

           [org.hornetq.ra] (default-threads - 1) HQ151000: awaiting topic/queue creation queue/MyQueue

       

       

      So, my questions are, 

       

       

      1) how can i use hornetq-ra adapter to consume messages from queue on standalone hornetq server? 

      2) where i can find hornet-ra.rar and ra.xml file in wildfly-8.0.0.Final and how can i deploy and use it? 

      3) where i'm doing wrong and what should i do to get my work done?

       

       

      If you need any information and files i'll provide immediately...

      Can anybody help me to get rid this problem... Thank you in advance.. 

        • 1. Re: MDB is not consuming Messages from Queue on standalone Hornetq
          Justin Bertram Master

          First i removed all messaging configuration from standalone.xml(wildfly).

          This is where your trouble started.  By removing the messaging subsystem you removed the pooled-connection-factory named hornetq-ra which the MDB is configured by default to use.

           

          1) how can i use hornetq-ra adapter to consume messages from queue on standalone hornetq server? 

          Start with putting the messaging subsystem configuration back into your standalone*.xml.  Then try again.  The MDB should at least deploy at this point since it will have access to the HornetQ RA.

           

          2) where i can find hornet-ra.rar and ra.xml file in wildfly-8.0.0.Final and how can i deploy and use it?

          WildFly doesn't ship with ra.xml as it isn't necessary.  The HornetQ JCA RA is configured using the pooled-connection-factory element.

           

          3) where i'm doing wrong and what should i do to get my work done?

          See my previous answers.

           

           

          You might also try reading the messaging subsystem documentation - especially the bit about JMS Connection Factories.  You can also pull HornetQ from GitHu, build it (mvn -Prelease install), and look at the Java EE examples.  I just updated them to work with WildFly 8.0.0.Final.  There are at least 2 JCA examples in there that might help you.

          1 of 1 people found this helpful
          • 2. Re: MDB is not consuming Messages from Queue on standalone Hornetq
            karna spartacus Newbie

            Thank you for your response @Justin.

            I just added back hornetq configuration to my standalone.xml and this time MDB is getting deployed but it is awaiting for queue/topic creation. in standalone hornetq server the queue is already created. but still MDB is not consuming messages from it.

            i have 2 doubts here.

            1) do i need to add below socket binding groups to my standalone.xml?( because i'm running wildfly and standalone hornetq server on same machine)

                   <socket-binding name="messaging" port="5445"/>

                    <socket-binding name="messaging-throughput" port="5455"/>

                 And do i need to add resoucre adapter configuration to  Resource adapter subsystem in my standalone.xml?

            2) do i need to bind hornetq server to my IP? or can i run on localhost only?


            i tried all above options,But still i'm not able to consume messages.. :-(

            • 3. Re: MDB is not consuming Messages from Queue on standalone Hornetq
              Justin Bertram Master

              I just added back hornetq configuration to my standalone.xml and this time MDB is getting deployed but it is awaiting for queue/topic creation.

              By default the HornetQ JCA RA uses JNDI to look up the destination.  I believe the problem here is that you haven't configured the JNDI look up properties to point to the remote server.  Setting "connectionParameters" is not sufficient for this because that only controls the HornetQ connection, not the JNDI connection.  Remember, JNDI and JMS are 100% independent specifications.  Using JNDI to look up JMS administered resources is only a convention set forth in the JMS specification, not an absolute requirement.  My suggestion would be to disable the JNDI look up by setting th "useJNDI" activation configuration property to "false" on the MDB and using the HornetQ name for the destination rather than the JNDI name.  This is the most straight-forward configuration for an MDB consuming from a remote destination.

               

              My guess is that you didn't follow my suggestion of looking at the HornetQ Java EE examples otherwise you would have seen this already.

               

              1) do i need to add below socket binding groups to my standalone.xml?( because i'm running wildfly and standalone hornetq server on same machine)

                     <socket-binding name="messaging" port="5445"/>

                      <socket-binding name="messaging-throughput" port="5455"/>

              If you want to host a HornetQ instance inside your WildFly server that is accessible to clients in other JVMs then you'll need those, otherwise you don't

               

                   And do i need to add resoucre adapter configuration to  Resource adapter subsystem in my standalone.xml?

              No.  Did you happen to read the documentation I cited in my previous comment?  If so, it should have clued you in to the fact that the HornetQ JCA RA is configured via the <pooled-connection-factory> element and/or the MDB activation configuration parameters.  There's no need to add anything to the resource adapter subsystem.

               

              2) do i need to bind hornetq server to my IP? or can i run on localhost only?

              If there are clients on other hosts that need to connect to your HornetQ instance then you would need to bind it to an accessible network interface.  Otherwise you can leave it bound to localhost.

              • 4. Re: MDB is not consuming Messages from Queue on standalone Hornetq
                karna spartacus Newbie

                Thank you Justin. i tried whatever you said, it is just working when i run hornetq and wildfly on same machine.

                My suggestion would be to disable the JNDI look up by setting th "useJNDI" activation configuration property to "false" on the MDB and using the HornetQ name for the destination rather than the JNDI name.  This is the most straight-forward configuration for an MDB consuming from a remote destination.

                i disabled JNDI lookup and try to use hornetq name as you said. then it is keep on saying

                HQ151004: Instantiating javax.jms.Queue "MyQueue" directly since UseJNDI=false.

                 

                When i run both hornetq and wildfly on same machine everything working fine, but when i run hornetq server on remote machine then my MDB not able to connect to hornetq server. i mentioned

                @ActivationConfigProperty(propertyName = "host", propertyValue = "remotehost"),

                  @ActivationConfigProperty(propertyName = "port", propertyValue = "5445") in my MDB.

                 

                And i observed in wildfly console when i deploy MDB,

                JBAS014105: ActivationConfigProperty port will be ignored since it is not allowed by resource adapter: myhornetq-ra

                JBAS014105: ActivationConfigProperty host will be ignored since it is not allowed by resource adapter: myhornetq-ra.

                 

                Can you please tell me,

                1) how  i can connect to remote hornetq server which is running on remote machine?

                2)where i should  mention remote host IP and port apart from in MDB?

                • 5. Re: MDB is not consuming Messages from Queue on standalone Hornetq
                  Justin Bertram Master

                  i tried whatever you said, but it is just working when i run hornetq and wildfly on same machine.

                  I'm confused on what exactly is and isn't working at this point.  Are you saying it works when everything is on the same machine and it isn't working when HornetQ and WildFly are on different machines?  If so, are you binding both servers to the appropriate network interface to enable remote communication?

                   

                  i disabled JNDI lookup and try to use hornetq name as you said. then  it is keep on saying

                  HQ151004: Instantiating javax.jms.Queue "MyQueue" directly since UseJNDI=false.

                  This is an INFO level message and is expected given your configuration.  I don't see a problem here.

                  • 6. Re: Re: MDB is not consuming Messages from Queue on standalone Hornetq
                    Justin Bertram Master

                    It looks like you updated your comment while I was composing mine.  In any event, I'll try to answer your latest questions now...

                     

                    And i observed in wildfly console when i deploy MDB,

                    JBAS014105: ActivationConfigProperty port will be ignored since it is not allowed by resource adapter: myhornetq-ra

                    JBAS014105: ActivationConfigProperty host will be ignored since it is not allowed by resource adapter: myhornetq-ra.

                    As the message here indicates, "host" and "port" are not valid activation configuration properties.

                     

                    Previously you were using:

                    @ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),

                    @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=localhost;port=5445")

                     

                    These are correct.  It's not clear to me why you stopped using these and started using the invalid "host" and "port" properties.

                     

                    1)how  i can connect to remote hornetq server which is running on remote machine?

                    Make sure the remote server is binding to the proper network interface to allow remote connectivity, and use the right activation configuration properties (see above).

                     

                    2)where i should  mention remote host IP and port apart from in MDB?

                    See my answer above.