[rabbitmq-discuss] Published message not queued after publish-ok received when connection quickly closed

Michael Nacos m.nacos at gmail.com
Fri Jul 8 17:37:38 BST 2011


the code is similar to the one I originally posted

    @queue1.subscribe(:ack => true) do |metadata, data|
      @channel.tx_select
      @channel.default_exchange.publish(data, \
        :routing_key => @deliver_to, \
        :persistent => true, \
        :nowait => false)
      puts '.'
      @channel.tx_commit
      metadata.ack
      @channel.tx_commit # <-- if not present, there is always one unacked
msg in @queue1
    end

it wasn't hanging, but because of the tx_select, the ack didn't happen until
the next time the consume callback was run, which I fixed by introducing
another tx_commit right after the ack. mind you, with one tx_commit right
after metadata.ack I lost messages.

On 8 July 2011 17:13, Michael Klishin <michael.s.klishin at gmail.com> wrote:

> 2011/7/8 Michael Nacos <m.nacos at gmail.com>
>
>> I forgot to mention my example code hangs if I introduce
>> @channel.tx_select and @channel.tx_commit around the publish call. I'm using
>> amqp 0.8.0rc13 + rabbit 2.4.1 & 2.5.1 -- perhaps this related to how
>> transactions work and the fact I'm re-using the same channel -- should I
>> even be doing this?
>
>
>
> No, it sounds like a bug. Can you post a small snippet of code that
> reproduces the issue?
>
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110708/79d318a0/attachment.htm>


More information about the rabbitmq-discuss mailing list