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

Michael Klishin mklishin at gopivotal.com
Mon Apr 28 13:52:16 BST 2014


On 28 April 2014 at 16:47:24, Loganathan Sellapa (loganathan.ms at gmail.com) wrote:
> > @ns_x.publish(message_body, :routing_key => "ipamAgent.operations",  
> :headers => message_headers, :mandatory => true)
> end
>  
> ch1.on_ack do |basic_ack|
> puts "Received basic_ack: multiple = #{basic_ack.multiple},  
> delivery_tag = #{basic_ack.delivery_tag}"
> end

You need to define the handler before you publish, otherwise you have
a race condition  (it makes sense
to do this right after calling confirm_select).
--  
MK  

Software Engineer, Pivotal/RabbitMQ


More information about the rabbitmq-discuss mailing list