Description of problem: The delivery count for receiver's prefetched messages is increased even if the messages was not seen by the application. # qpid-send --messages 3 --address "q;{create:sender}" # qpid-receive --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q Properties: {sn:1, ts:1387456209158654200} # qpid-receive --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q Redelivered: true Properties: {sn:2, ts:1387456209158736790, x-amqp-delivery-count:1} The redelivered flag is set to true and x-amqp-delivery-count is increased When the capacity is set to be 0, the behavior is as expected: # qpid-send --messages 10 --address "q;{create:sender}" # qpid-receive --capacity 0 --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q Properties: {sn:1, ts:1387463670006783616} # qpid-receive --capacity 0 --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q Properties: {sn:2, ts:1387463670006894302} Version-Release number of selected component (if applicable): qpid-cpp-*-0.22-29 How reproducible: 100% Steps to Reproduce: 1. send a message using qpid-send (use default capacity) 2. receive single message 3. receive next message 4. the message is marked as redelivered and x-amqp-delivery-count is increased Actual results: Delivery count increased and redelivered flag set for prefetched messages Expected results: Messages that was not seen by the application shall not be marked redelivered and the delivery caount shall not be increased. Additional info: Not exactly sure what shall be the correct behavior here, feel free to change to doc bug when this issue will be identified as correct behavior. See bug 975422, comment 2
Fixed upstream: https://svn.apache.org/r1560718 Now, when a receiver is closed, any prefetched messages - those delivered to the client by the broker that have not been returned to the application - will be released, which prevents the delivery count being incremented.