MassTransit Ack/Nack behavior with RabbitMQ?

2,812 views
Skip to first unread message

Eric Swann

unread,
Dec 10, 2012, 3:19:44 PM12/10/12
to masstrans...@googlegroups.com
Based on the code I've seen, it looks like the following is the Ack/Nack behavior of MassTransit when working with RabbitMQ.  Could you guys correct any incorrect information here?

  1. Each consumer is newed up as a message is handled and run on its own thread from the pool.
  2. In the MT consumer object that wraps your message consumer, the message is dequeued and delivered to the message consumer.
  3. If the message is completed without error, an Ack is returned to Rabbit.
  4. If message consumption fails (meaning the consumer throws an exception), but is below the failure threshold, the message republished and acked to clear the previous message from the queue.
  5. If message consumption fails and is over failure the threshold, the message is acked (not nacked) and then moved to the error queue by MassTransit.
  6. If a message delivery error is encountered, basically the message is not successfully retrieved by MT, the message is nacked which will cause redelivery by Rabbit.
Does that sound basically correct?  Is there anything important that I've missed here?

Thanks!
Eric

Chris Patterson

unread,
Dec 11, 2012, 11:36:37 AM12/11/12
to masstrans...@googlegroups.com
Number 4 is incorrect, if the message fails (exception thrown from consumer), the message is Nack'd, and stays at the front of the queue as per RabbitMQ behavior on a nacked message.



--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/masstransit-discuss/-/4zF51X9JUggJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Eric Swann

unread,
Dec 11, 2012, 12:45:53 PM12/11/12
to masstrans...@googlegroups.com
Hi Chris, what led me to #4 was the following code inside of the RabbitMqConsumer.  It looks like MessageFailed is called when an exception bubbles up from the consumer which performs a publish and Ack.  Can you tell me under what circumstances this is called?  

        public void MessageFailed(BasicDeliverEventArgs result)
        {
            _channel.BasicPublish(_address.Name, "", result.BasicProperties, result.Body);
            _channel.BasicAck(result.DeliveryTag, false);
        }


On Tuesday, December 11, 2012 10:36:37 AM UTC-6, Chris Patterson wrote:
Number 4 is incorrect, if the message fails (exception thrown from consumer), the message is Nack'd, and stays at the front of the queue as per RabbitMQ behavior on a nacked message.

On Mon, Dec 10, 2012 at 12:19 PM, Eric Swann <er...@ericswann.org> wrote:
Based on the code I've seen, it looks like the following is the Ack/Nack behavior of MassTransit when working with RabbitMQ.  Could you guys correct any incorrect information here?

  1. Each consumer is newed up as a message is handled and run on its own thread from the pool.
  2. In the MT consumer object that wraps your message consumer, the message is dequeued and delivered to the message consumer.
  3. If the message is completed without error, an Ack is returned to Rabbit.
  4. If message consumption fails (meaning the consumer throws an exception), but is below the failure threshold, the message republished and acked to clear the previous message from the queue.
  5. If message consumption fails and is over failure the threshold, the message is acked (not nacked) and then moved to the error queue by MassTransit.
  6. If a message delivery error is encountered, basically the message is not successfully retrieved by MT, the message is nacked which will cause redelivery by Rabbit.
Does that sound basically correct?  Is there anything important that I've missed here?

Thanks!
Eric

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To post to this group, send email to masstrans...@googlegroups.com.
To unsubscribe from this group, send email to masstransit-discuss+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages