8 Replies Latest reply on Apr 5, 2012 11:15 AM by Justin Bertram

    How to connect an MDB to a remote queue on 7.1 Beta1?

    lars-ho Newbie

      I have an MDB that should listen to a remote HorentQ queue. I have tryed the following configuration in standalone-full.xml:

      {code:xml}

              <subsystem xmlns="urn:jboss:domain:messaging:1.1">

                  <hornetq-server>

      ...

                      <connectors>

                          <netty-connector name="netty" socket-binding="messaging-client"/>

                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput-client">

                              <param key="batch-delay" value="50"/>

                          </netty-connector>

                          <in-vm-connector name="in-vm" server-id="0"/>

                      </connectors>

      ...

       

          <socket-binding-group name="standard-sockets" default-interface="public">

      ...

              <outbound-socket-binding name="messaging-client">

                  <remote-destination host="1.2.3.4" port="5445"/>

              </outbound-socket-binding>

              <outbound-socket-binding name="messaging-throughput-client">

                 <remote-destination host="1.2.3.4" port="5455"/>

              </outbound-socket-binding>

          </socket-binding-group>

      {code}

      When I deploy my MDB, it logs the following:

       

      13:46:50,629 INFO  [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 2) Attempting to reconnect org.hornetq.ra.inflow.HornetQActivationSpec(ra=org.hornetq.ra.HornetQResourceAdapter@1e7258e destination=queue/textQueue destinationType=javax.jms.Queue ack=Auto-acknowledge durable=false clientID=null user=null maxSession=15)

      13:46:50,632 INFO  [org.hornetq.ra.inflow.HornetQActivation] (default-short-running-threads-threads - 2) awaiting topic/queue creation queue/textQueue

       

      I am certain that the remote queue is actually there, because this same MDB was working in AS 7.0, but then with a @ResourceAdapter("jms-ra.rar") annotation where jms-ra.rar had the remote queue configured in ra.xml:

       

      {code:xml}


        <config-property>


      <description>The transport type</description>


      <config-property-name>ConnectorClassName</config-property-name>


      <config-property-type>java.lang.String</config-property-type>


      <config-property-value>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</config-property-value>

        </config-property>

        <config-property>


      <description>The transport configuration. These values must be in the form of key=val;key=val;</description>


      <config-property-name>ConnectionParameters</config-property-name>


      <config-property-type>java.lang.String</config-property-type>


      <config-property-value>host=1.2.3.4;port=5445</config-property-value>

        </config-property>

       

      {code}

       

      What am I missing?

        • 2. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
          Vikas B Newbie

          Having the same problem with Topic...Did anyone find solution ?

          • 3. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
            Justin Bertram Master

            Have you guys tried annotating your MDB with the appropriate activation configuration properties?  For example:

             

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

                    @ActivationConfigProperty(propertyName = "destination", propertyValue = "myQueue"),

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

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

             

            You definitely shouldn't need to add any sockets to standalone*.xml.

            • 4. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
              Vikas B Newbie

              I tried with following configuration...it did not work

               

               

              On JBOSS instance 2

                

              @MessageDriven

               

              (

              activationConfig = {

               

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

              ),

               

               

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/sampleTopic"

              ),

               

               

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

              ),

               

               

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

              )}

               

               

              I am not sure what port we have to specify here....I tried 5445 and 4447

               

              Following snippet is from my standalone-full.xml from server where I deployed my topic

               

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

              On JBOSS instance 1 :

              <jms-topic name="sampleTopic">
                                      <entry name="topic/sampleTopic"/>
                                      <entry name="java:jboss/exported/jms/topic/sampleTopic"/>
                                  </jms-topic>
                              </jms-destinations>

              I am trying to push JMS message on JBOSS instance 1 and trying MDB deployed on instance 2 to receive the message

              )

              • 5. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
                Justin Bertram Master

                You definitely shouldn't be using port 4447 as that is a port used by JBoss Remoting 3.x which nothing in HornetQ needs (or understands).  You should use the hostname and port number where HornetQ is listening which is typically 5445 and/or 5455.

                 

                Also, the "destination" should not be the JNDI name of the destination, but the basic HornetQ name which in your configuration is "sampleTopic".

                 

                If you continue to have problems please elaborate on your use-case and post actual errors you are seeing in the log (if any) so that I can be of further assistance.

                • 6. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
                  Vikas B Newbie

                  Thanks Justin for your reply...I appreciate it.. Let me create simple sample program and post it.. I do not get any error on my another instance where MDB is deployed....so I wanted to make sure message is coming to instance 1

                   

                  when message is sent from JMS client , .. On JBOSS instance 1 where I have topic deployed .....shows this message in the log file 4:38:37,303 INFO  [org.jboss.as.naming] (Remoting "vikasbali" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 6a9c8d7e (inbound) of Remoting connection 594
                  b7042 to /127.0.0.1:62409

                  • 7. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
                    Vikas B Newbie

                    Justin, Thanks for your help...Sample program worked....

                     

                    Only thing I need to change was adding user and password as while publishing message I had to do that as well...not sure if it is required or not...but without it I was getting following exception

                     

                     

                    javax.jms.JMSSecurityException: Unable to validate user: null

                        at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:312)

                        at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:780)

                        at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:279)

                        at org.hornetq.jms.client.HornetQConnection.authorize(HornetQConnection.java:601)

                        at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:684)

                        at org.hornetq.jms.client.HornetQConnectionFactory.createTopicConnection(HornetQConnectionFactory.java:143)

                        at org.hornetq.jms.client.HornetQConnectionFactory.createTopicConnection(HornetQConnectionFactory.java:138)

                        at com.test.TestHelloWorldBean.publishMsg(TestHelloWorldBean.java:50)

                        at com.test.TestHelloWorldBean.<init>(TestHelloWorldBean.java:29)

                        at com.test.TestHelloWorldBean.main(TestHelloWorldBean.java:179)

                    Caused by: HornetQException[errorCode=105 message=Unable to validate user: null]

                        ... 10 more

                     

                     

                    @ActivationConfigProperty(propertyName = "user", propertyValue = "jmsUser"),
                    @ActivationConfigProperty(propertyName = "password", propertyValue = "password")
                    • 8. Re: How to connect an MDB to a remote queue on 7.1 Beta1?
                      Justin Bertram Master

                      All remote connectivity to AS7 is secured by default, so it's not surprising you would need to pass the appropriate credentials.