Trying to interpret the AMQP spec regarding credit and aborted mesages. http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#doc-flow-control says this: "The *delivery-count* is initialized by the sender when a link endpoint is created, and is incremented whenever a message is *sent*. Only the sender MAY independently modify this field. The receiver's value is calculated based on the last known value from the sender and any subsequent messages *received* on the link." It goes on to say how credit is computed from delivery count.
My question: for a multi-frame message do *sent* and *received* refer to the first or last frame of the message? The distinction matters if a message is aborted: FIRST: aborted messages are counted in the delivery count, and they do consume a credit. The receiver of an aborted message must discard the message, but must account for the delivery in link state exactly as if it had been completed. In particular the receiver must send a credit for the aborted message to keep messages flowing. The sender accounts for the aborted message as for a completed message. LAST: aborted messages are treated as if they never existed. They aren't counted by delivery count, they don't consume credit. The receiver of an abort frame should throw the delivery away and leave link state as it was before the message started to arrive. The sender of an aborted message should have link state as if the message had never been sent. I prefer LAST because I like the clarity of this sentence: "as far as possible, an aborted message is treated as if it never existed". However I can't find anything else in the spec to decide either way. Sadly, proton does the accounting LAST on the sender but FIRST on the receiver, so that doesn't help. The receiver has a comment: // XXX: multi transfer. Sigh. Cheers, Alan.
