5 Replies Latest reply on Jan 7, 2015 12:30 PM by tari_manga

    Core bridge between 2 topics not working

    danasabiescu

      Hello,

       

      I have the following sittuation: 4 JBoss 6.1 instances, grouped in 2 clusters: servers A1 and A2 in a cluster, and S1 and S2 into another cluster. A1 and S1 are installed on the same machine, and A2 and S2 on a different machine.

      On all the 4 servers I have deployed multiple queues and one topic. The purpose is to send one messega from S1 or S2, and to process the messega on A1 or A2 (for the queues), or on all the 4 servers (for the topic). For the topic, a MDB is deployed on all the 4 servers.

       

      To achive this, I tried to define a core bridge for each queue and topic. For now I am trying to make the communication work between S1 and A1, but my bridges doesn't seem to work for the topic, only for the queues.

       

      My configuration is the following:

       

      On S1, I have the topic defined in hornetq-jms.xml:

       

         <topic name="ArchiveQ">
            <entry name="/topic/ArchiveQ"/>
         </topic>
      

       

      In the hornetq-configuration.xml, I have defined a remote connector, the core queues and the bridge:

       

       

      <connectors>
            ....
            <connector name="netty-remote">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
              <param key="host"  value="${jboss.bind.address:localhost}"/>
               <param key="port"  value="5946"/>
            </connector>
            ....
         </connectors>
      
         <acceptors>
            ...
         </acceptors>
      
         <queues>   
               <queue name="jms.queue.ArchiveQ">
                    <address>jms.queue.ArchiveQ</address>
              </queue>
             <!-- other queues....-->
         </queues> 
      
         <bridges>
            
          <bridge name="archive-bridge">
                
              <queue-name>jms.queue.ArchiveQ</queue-name>
                
              <forwarding-address>jms.topic.ArchiveQ</forwarding-address>
                          
              <reconnect-attempts>100</reconnect-attempts> 
                
              <static-connectors>
                   
                  <connector-ref>netty-remote</connector-ref>
                
              </static-connectors>
             
          </bridge>
             <!-- other bridges.....-->   
         </bridges> 
      

       

       

      On A1 server, I have defined the topic in hornetq-jms.xml, same as on S1, and in hornetq-configuration.xml I have defined an acceptor:

       

          <acceptor name="sync">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
               <param key="host"  value="${jboss.bind.address:localhost}"/>
               <param key="port"  value="5946"/>
            </acceptor>
      

       

      The bridge (archive-bridge) seems to connect to its destination, I found in S1 log the following entry:

       

      2012-01-27 11:00:49,144 INFO  [org.hornetq.core.server.cluster.impl.BridgeImpl] (Thread-24 (group:HornetQ-server-threads409421270-1317559971)) Connecting bridge archive-bridge to its destination [9fae8673-ef28-11e0-b105-0050569a0055]
      2012-01-27 11:00:49,159 INFO  [org.hornetq.core.server.cluster.impl.BridgeImpl] (Thread-24 (group:HornetQ-server-threads409421270-1317559971)) Bridge archive-bridge is connected [9fae8673-ef28-11e0-b105-0050569a0055-> archive-bridge]
      

       

      But when a messege is sent from S1, on the ArchiveQ topic, the messege is processed by the MDB deployed on S1 and nothig happens on A1.

       

      My question is, what am I doing wrong? I have attached the configuration files.

       

      Thank you!

        • 1. Re: Core bridge between 2 topics not working
          mcpata2002

          I've just made a test, it seems core bridge only copy message between "queue", no topic-to-queue nor queue-to-topic. I'll proceed to test JMS Bridge, hope it rocks.

          • 2. Re: Core bridge between 2 topics not working
            ataylor

            I've just made a test, it seems core bridge only copy message between "queue", no topic-to-queue nor queue-to-topic. I'll proceed to test JMS Bridge, hope it rocks.

            Theres no such thing as a topic at coe level, only addresses and queues, but you will be able to do what you want. read the manual about how addresses map to topics and queues and you will understand.

            • 3. Re: Core bridge between 2 topics not working
              mcpata2002

              I hope so because I need to copy messages from a topic to a queue. I have successfully copy from queue but never between topics and queues or between topics. Originally I came here for hints but I read this post so I just share my findings. I'm on 2.2.5.Final running standalone which I have no time digging into HornetQ source yet. Highly appreciate if anybody can demonstrate a working sample. I'm now stuck in the JMSBridge where I cannot find a TransactionManager for inject.

              • 4. Re: Core bridge between 2 topics not working
                mcpata2002

                Thanks for Andy points out the differences between core level hornetq and JMS context. Here I make it rocks:

                 

                First of all, remove all queue in hornetq-jms.xml. These queues will be created after hornetq-configuration.xml fully loaded.

                 

                Create the JMS queue and topic in hornetq-configuration.xml. In my case, I want a "topic" named A and setup a bridge to copy all messages to a queue B, both accessible via JMS.

                 

                <queues>

                  <queue name="jms.topic.A">

                    <address>jms.topic.A</address>

                    <durable>true<durable>

                  </queue>

                  <queue name="queue.for.bridge">

                    <address>jms.topic.A</address>

                    <durable>true</durable>

                  </queue>

                  <queue name="jms.queue.B">

                    <address>jms.queue.B</address>

                    <durable>true</durable>

                  </queue>

                </queues>

                 

                All queues with address "jms.topic.*" will be a topic in JMS and address with "jms.queue.*" will be a queue.

                 

                I have two queues with the same address "jms.topic.A", one for JMS and another one for the core bridge.

                 

                Here's the bridge part:

                 

                <bridges>

                  <bridge name="a-to-b">

                    <queue-name>queue.for.bridge</queue-name>

                    <forwarding-address>jms.queue.B</forwarding-address>

                    <reconnect-attempts>-1</reconnect-attempts>

                    <static-connectors>

                      <connector-ref>netty</connector-ref>

                    </static-connectors>

                  </bridge>

                </bridges>

                 

                It works, I can subscribe to topic A for monitoring as well as a pool of workers to dequeue from queue B.

                 

                Please comment.

                • 5. Re: Core bridge between 2 topics not working
                  tari_manga

                  Thank you for your post, I've found it very helpful for creating a core-bridge between a Topic and Queue on two separate HornetQ respectively inside two separate WildFly instances.