[rabbitmq-discuss] Acknowledgement bug with Tx

Yogesh Ketkar yogimogi at gmail.com
Sun Feb 5 06:48:33 GMT 2012


There are 2 queues q1 and q2.

       | Ready  | Unacked  |  Total   |
q1   |    100   |            0  |     100  |
q2   |       0   |            0  |        0   |


Now this code runs
GetResponse r = ch.basicGet(q1, false);
if(r != null) {
    // read message body and change it slightly
    ch.queueBind(q2, exchange, q2);
    ch.txSelect();
    ch.basicPublish(exchange, q2, props, changed_body);
    ch.txCommit();
    ch.basicAck(r.getEnvelope().getDeliveryTag(), false);
}

In-spite of doing backAck in the status, Unacked message count is 1.

       | Ready  | Unacked  |  Total   |
q1   |       99  |            1  |     100  |
q2   |       1   |            0  |        1   |

And now if I pause the program, this state remains forever and if I
kill the program, it looks like

       |    Ready  | Unacked  |  Total   |
q1   |       100  |            0  |     100  |
q2   |         1   |            0  |        1   |

Strangely, it happens only the first time, i.e. If I keep on running
this code, in the end status looks like.
I have acknowledged all 100 messages, but broker gets only 99
acknowledgments.

       |    Ready  | Unacked  |  Total   |
q1   |          0    |            1   |     1      |
q2   |         0     |            0  |        0    |

Can anyone explain what is going on here?

regards, Yogesh


More information about the rabbitmq-discuss mailing list