[rabbitmq-discuss] Active-Active implementation issues

Gomathi Nayagam sgnayagam at gmail.com
Mon Jul 1 11:57:22 BST 2013


Hi

Thanks for the reply.

My inline response are below.

---------- Forwarded message ----------
From: Simon MacMullen <simon at rabbitmq.com>
Date: Mon, Jul 1, 2013 at 2:44 PM
Subject: Re: [rabbitmq-discuss] Active-Active implementation issues
To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
Cc: Gomathi Nayagam <sgnayagam at gmail.com>


Hi. Couple of points:

1) It's not *guaranteed* that after you acknowledge a message you will
never see it again after failover - the ack has to travel across the
network and be received by the broker, and if failover happens between the
broker sending the message out and receiving an ack then you will see the
message again.

[Reply] I agree with this point.


2) If this is not happening, make sure you are acknowledging the messages
correctly - make sure they vanish from the console when failover is not an
issue.

[Reply] Let's take the below example, the queue has 20 messages and after
13 messages are consumed (11 messages are acked, 2 messages ack are not
reached to broker) Node1 is down. So in the Node2 we could see 9 messages.
But the consumer consumes and acked all 9 messages (i can get the print
statements inside handleCancel()) during the fail over, but the messages
are not vanishing from the console. It leads to duplication of messages.

Thanks



On Mon, Jul 1, 2013 at 3:31 PM, Gomathi Nayagam <sgnayagam at gmail.com> wrote:

> Hi
>
> Thanks for the reply.
>
> My inline response are below.
>
> ---------- Forwarded message ----------
> From: Simon MacMullen <simon at rabbitmq.com>
> Date: Mon, Jul 1, 2013 at 2:44 PM
> Subject: Re: [rabbitmq-discuss] Active-Active implementation issues
> To: Discussions about RabbitMQ <rabbitmq-discuss at lists.rabbitmq.com>
> Cc: Gomathi Nayagam <sgnayagam at gmail.com>
>
>
> Hi. Couple of points:
>
> 1) It's not *guaranteed* that after you acknowledge a message you will
> never see it again after failover - the ack has to travel across the
> network and be received by the broker, and if failover happens between the
> broker sending the message out and receiving an ack then you will see the
> message again.
>
> [Reply] I agree with this point.
>
>
> 2) If this is not happening, make sure you are acknowledging the messages
> correctly - make sure they vanish from the console when failover is not an
> issue.
>
> [Reply] Let's take the below example, the queue has 20 messages and after
> 13 messages are consumed (11 messages are acked, 2 messages ack are not
> reached to broker) Node1 is down. So in the Node2 we could see 9 messages.
> But the consumer consumes and acked all 9 messages (i can get the print
> statements inside handleCancel()) during the fail over, but the messages
> are not vanishing from the console. It leads to duplication of messages.
>
> Thanks
>
> Cheers, Simon
>
>
> On 01/07/2013 09:33, Gomathi Nayagam wrote:
>
>> I am trying to implement the active-active High availability Queue and i
>> have some issues in the implementation. The problem is when we consume
>> messages from the Mirrored queue if any one of the node is down, we can
>> able to consume the messages after the node failure. But the consumed
>> messages after the node failure are still available in the rabbitmq
>> console even after acking all of the messages.
>>
>> Some information about the overview of the configuration to test
>> active-active queues
>>
>> I have NODE1 in Host1 and NODE2 in Host2. Both of the nodes are in
>> cluster. I have a Queue named TestQ in NODE1, since i have made this
>> queue (TestQ) as Mirrored Queue through the policies it is available in
>> Node2 which is running in Host2.
>>
>> I am passing the array of Address(Host1, Host2) to get the connection in
>> my consumer. the code snippet is
>>
>> Address address1 = new Address(Host1, 5672);
>> Address address2 = new Address(Host2, 5672);
>>
>> RabbitmqConsumer consumer = new RabbitmqConsumer(new Address[]{address1,
>> address2}, queue);
>>
>> While getting the connection,
>> Connection conn = connectionFactory.**newConnection(addresses);
>>
>> My use case is as below.
>>
>> I have 30 messages in TestQ and i can see it in the RabbitMQ console of
>> Host1,Host2 looks like below
>>
>> Host1:
>> Name    Node
>> TestQ    rabbit at Node2
>>
>> Host2:
>> Name    Node
>> TestQ    rabbit at Node2
>>
>> In my consumer, I have implemented my own consumer as below.
>>
>> class MyConsumer extends QueueingConsumer{
>>
>>      Channel channel;
>>      public MyConsumer(Channel ch) {
>>          super(ch);
>>          this.channel = ch;
>>      }
>>
>>      @Override
>>      public void handleCancel(String consumerTag)  {
>>          System.out.println("**handleCancel :: consumertag
>> "+consumerTag+"
>> channel opened "+channel.isOpen()+",channel "+channel+", rabbitmq
>> consumer ch "+RabbitmqConsumer.ch);
>>
>>      }
>> }
>>
>> If i run my consumer, it creates a channel with the reference of
>> AMQChannel(amqp://guest@Host1:**5672/,1) and it consumes the messasges
>> from the TestQ. I have checked the consumer tag of the channel in both
>> of the host and both are same.
>>
>> After some of the messages (assume 10 messages) are consumed, i
>> explicitly down the Node2 by giving the below command
>>
>> node2$ ./rabbitmqctl stop_app
>>
>> After the failure of Node2, i can see the print statements which i added
>> in the handleCancel() method and consumer consumes all of the messages
>> with out any error. The problem is the even though the remaining 20
>> messages are consumed and acked in the consumer, but if i check it in
>> the rabbitmq console, the 20 messages are still exists in the TestQ.
>>
>> What i have to do in this scenario to overcome this issue.
>>
>>
>> ______________________________**_________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.**rabbitmq.com<rabbitmq-discuss at lists.rabbitmq.com>
>> https://lists.rabbitmq.com/**cgi-bin/mailman/listinfo/**rabbitmq-discuss<https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130701/614d0894/attachment.htm>


More information about the rabbitmq-discuss mailing list