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

Loganathan Sellapa loganathan.ms at gmail.com
Mon Apr 28 14:04:29 BST 2014


Ok, I updated the coed as below.

   ch1.on_ack do |basic_ack|
        puts "Received basic_ack: multiple = #{basic_ack.multiple},
delivery_tag = #{basic_ack.delivery_tag}"
   end

      10.times do
        @ns_x.publish(message_body,  :routing_key =>
"ipamAgent.operations", :headers => message_headers, :mandatory => true)
      end

Can you let me know  your comments for the below questions

1.  How can I identify the message along with the message contents for
which didn't get the acknowledgement ?

2. While publishing the 10 messages, I received acknowledgement for 5
messages only. I suspect RabbitMq sent acknowledgement for multiple
messages on 5 & 10, if so then how can we make sure that the
acknowledgement is meant for message 1,2,3,4 and 5 in "Received basic_ack:
multiple = #<AMQ::Protocol::Basic::Ack:0x96d6560 @delivery_tag=5,
@multiple=true>, delivery_tag = 5"

*Acknowledgement O/p for 10 messages:*

 Received basic_ack: multiple = #<AMQ::Protocol::Basic::Ack:0x96d6560
@delivery_tag=5, @multiple=true>, delivery_tag = 5
Received basic_ack: multiple = #<AMQ::Protocol::Basic::Ack:0x96d5f84
@delivery_tag=6, @multiple=false>, delivery_tag = 6
Received basic_ack: multiple = #<AMQ::Protocol::Basic::Ack:0x96d5700
@delivery_tag=7, @multiple=false>, delivery_tag = 7
Received basic_ack: multiple = #<AMQ::Protocol::Basic::Ack:0x96d50c0
@delivery_tag=8, @multiple=false>, delivery_tag = 8
Received basic_ack: multiple = #<AMQ::Protocol::Basic::Ack:0x972ce10
@delivery_tag=10, @multiple=true>, delivery_tag = 10

3. How do we ensure that message is successfully published to the
exchange.(I want some way to identify the message is sent from ruby client
to RabbitMq exchange successfully)

regards,
Loganathan
Mob: +91 7760780741 | +91 9944414388
Skype: loganathan.sellappa
ViewMe <http://vizualize.me/loganathan>



On Mon, Apr 28, 2014 at 6:22 PM, Michael Klishin <mklishin at gopivotal.com>wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140428/141adcca/attachment.html>


More information about the rabbitmq-discuss mailing list