4 Replies Latest reply on Dec 15, 2014 9:44 AM by Vladimir Vasilev

    Camel route between Fabric 1 with Master/Slave and Fabric 2 with Network of Brokers

    Vladimir Vasilev Newbie

      Hi all,

       

      I need help setting my camel routes. The setup is:

      Fabric 1 has Master/Slave brokers (one master, two slaves).  dmz.com in the blueprint

      Fabric 2 has two pairs of Master/Slave networked together. rdu2.com and bos.com in the blueprint

       

      I want a camel route from a topic in Fabric 1 to go to the same topic in Fabric 2 (camel needs to be started on fabric 2)

       

      As suggested by one colleague I'm trying to implement this with camel load balancer and failover. Partial success..

       

      Test is:

      1. In Fabric 1 all 3 brokers in dmz.com are running.

      2. In Fabric 2 start only fuse-fabric-01.rdu2.com and fuse-fabric-01.bon.com (to form two masters).

      3. Connect consumer to rdu2.com (with failover to bos).

      4. Start publishing to dmz.com

      All good, the consumer is getting the messages.

      5. Stop rdu2.com broker

      Consumer is reconnected to bos.com, still receiving messages. bos.com broker gets exceptions that rdu2.com is down (as expected)

      6. Start rdu2.com and when it's up stop bos.com broker

      Consumer is reconnected to rdu2.com but NO messages received. The broker is giving exceptions that connection failed:

       

      org.springframework.jms.IllegalStateException: org.apache.activemq.ConnectionFailedException: The JMS connection has failed: Connection refused; nested exception is javax.jms.IllegalStateException: org.apache.activemq.ConnectionFailedException: The JMS connection has failed: Connection refused

       

      Any ideas what I'm doing wrong? Or I should use different approach to do this?

       

      Thanks

        • 1. Re: Camel route between Fabric 1 with Master/Slave and Fabric 2 with Network of Brokers
          Willem Jiang Newbie

          Hi Vladimir,


          What's your meaning of "Consumer"?

          Is it camel jms consumer or jms client?


          Can you explain that "5 bos.com broker gets exceptions that rdu2.com is down (as expected)"?

          It looks like the exception is throws from the broker and Camel router doesn't know anything about it.

           

          "Consumer is reconnected to rdu2.com but NO messages received. "

          Do you mean broker rdu2.com doesn't receive any message?

          • 2. Re: Camel route between Fabric 1 with Master/Slave and Fabric 2 with Network of Brokers
            Vladimir Vasilev Newbie

            Hi Willem,

             

            For both consumer and producer I use "external-mq-fabric-client" from Fuse by Examples but connecting with failover() instead of discovery()

             

            I'm attaching karaf.log from the BOS broker instance (camel and broker runs on the same container). Also attaching some camel output from karaf CLI.

            The broker receive the message but can't route them to the consumer. "Exchanges Total" and "Exchanges Failed are increasing".

             

            In this example I was connected initially to broker RDU2, received a few messages then shutdown rdu2, reconnect to broker bos but no messages received. Producer was sending messages for the whole time of the test.

            • 3. Re: Camel route between Fabric 1 with Master/Slave and Fabric 2 with Network of Brokers
              Vladimir Vasilev Newbie

              I did the logic a bit simpler. Now I have two connection factories, 1st is for DMZ fabric and second is for both RDU2 and BOS (again with failover() ). No camel load balancing.

               

              Now the simple test case which works perfectly:

               

              All rdu2 brokers are started

              1. Client connects to rdu2 host 1 (current master).

              2. Publisher push messages to dmz fabric, the client in rdu2 broker is getting the message

              3. Stop publisher

              4. Stop rdu2 host 1, client detects this and reconnects to rdu2 host 2

              5. Start publisher and again client is getting messages.

               

              This means basic failover works, camel is routing correctly to the next elected master

               

              Now if I do the very same test but without stopping the publisher I'm getting the JMS exceptions as attached above:

              2014-11-25 18:14:52,240 | ERROR | rg.jboss.issues] | DefaultErrorHandler | rg.apache.camel.util.CamelLogger 215 | 136 - org.apache.camel.camel-core - 2.12.0.redhat-611412 | Failed delivery for (MessageId: ID:zaska-54402-1416939267471-1:1:1:1:20 on ExchangeId: ID-fuse-fabric-02-rdu2-41792-1416939222035-0-8). Exhausted after delivery attempt: 1 caught: org.springframework.jms.IllegalStateException: javax.jms.JMSException: Stopped.; nested exception is javax.jms.IllegalStateException: javax.jms.JMSException: Stopped.

               

              Does this "Stopped" means that the broker is down or the camel route is down? Looks like it's somehow stuck and don't want to reconnect.

              Do I need to do some additional logic for Error Handling and Dead Letter Channel/queue?

              • 4. Re: Camel route between Fabric 1 with Master/Slave and Fabric 2 with Network of Brokers
                Vladimir Vasilev Newbie

                I made it working by putting all brokers in fabric 2 on one connection factory with failover() and added initialReconnectDelay=2000&timeout=5000