[rabbitmq-discuss] [RUBY-AMQP GEM] How do we can retry publish message on errors?

Michael Klishin mklishin at gopivotal.com
Mon Apr 28 12:20:05 BST 2014


 On 28 April 2014 at 15:17:34, Loganathan Sellapa (loganathan.ms at gmail.com) wrote:
> > So I assumed that RabbitMq will re-publish the message automatically,  
> whenever RabbitMq recovered from failover case.

That’s not true.

> My question  
> is how can I make publish the message(from producer to RabbitMq  
> broker), when some exceptions occurred while publishing the  
> message to rabbitMq channel. Below is my sample code for it.  

Handle exceptions from Exchange#publish. Note that this does not cover
cases when EventMachine event loop just dies under you but there’s nothing
amqp gem can do.

This is also why unless you already use EventMachine heavily, you
should use Bunny or March Hare:

https://github.com/ruby-amqp/amqp#a-word-of-warning-use-this-only-if-you-already-use-eventmachine
--  
MK  

Software Engineer, Pivotal/RabbitMQ


More information about the rabbitmq-discuss mailing list