2 Replies Latest reply on Jul 6, 2010 7:29 AM by t0m.guenter

    Message loss on failover

    t0m.guenter

      Hello,

       

      we encountered a problem with a failover configuration. Our JMS clients are connected to two brokers and if the first broker goes down, they failover to the second one. However, we loose one message for every client during reconnection.

       

      In an older post (http://old.nabble.com/ActiveMQ-message-loss-on-failover-td28664192.html#a28664192) I found the advice to use alwaysSyncSend, but this did not help either.

       

      Does someone know what we have to do to prevent message losses?

       

      Our setup:

       

      The two brokers (fuse-message-broker-5.3.1-00-00) are connected to each other via a network connection:

       

       

      <networkConnector name="activeMqBrokerNetwork" uri="static://(tcp://192.168.2.23:61616)" userName="admin" password="pw"/>

       

       

       

       

      Each broker is working in non-persistent mode. However, I also tried to run it with AMQ persistence but with the same behaviour.

       

       

       

       

       

       

      The clients are based on spring jms template, write request messages continuously to an input queue and wait for the responses on an output queue. The connection factory is set to alwaysSyncSend:

       

       

      <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL" value="${siggw.broker.uri}" />
      <property name="userName" value="${siggw.user}" />
      <property name="password" value="${siggw.password}" />
      <property name="alwaysSyncSend" value="true" />
      </bean>

       

       

       

       

      The server process is based on servicemix (fuse-4.2) and camel. It basically receives the request from the input queue, processes it and writes the response to the output queue. The connection uri looks like the following:

       

       

      failover:(tcp://localhost:61616,tcp://192.168.2.23:61616)?randomize=false&jms.alwaysSyncSend=true

       

       

       

       

      Every advice is appreciated.

       

      Thanks in advance.

      Thomas

       

       

        • 1. Re: Message loss on failover
          garytully

          If you must have guaranteed message delivery you need to use persistent messages and transacted sessions.

          Then, worst case scenario is that a transaction will be forced to rollback in the event of 1) non redelivery of messages or 2) outstanding commit replies.

           

          If you can deal with missing reply messages, then just enabling transacted sends will suffice, but you need to enable persistence such that a message sent to one broker will be visible on the other in the event of failover.

          • 2. Re: Message loss on failover
            t0m.guenter

            Hi,

            thanks for your reply.

            Since performance has a higher value than message loss, I will stick to the non-persistent setup.

             

            Due to a firewall problem, the clients tried to reconnect to another broker after a short time wich caused a lot of lost messages but since this is solved now, reconnects are really seldom and therefor the chance for message loss is quite low.

             

            Regards,

            Thomas