qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Godfrey <rob.j.godf...@gmail.com>
Subject Re: AMQP spec question: aborted messages and credit.
Date Mon, 02 Oct 2017 22:01:33 GMT
On 2 October 2017 at 23:37, Alan Conway <aconway@redhat.com> wrote:

> 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:

I was having this discussion with Robbie over IRC not long ago - we should
probably raise a spec clarification JIRA over at OASIS.

> 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.
So - I think the "correct" answer should be FIRST for both sender and
receiver.  Consider the following case:

A sender starts sending a very large message to a receiver.  The receiver
parses the message as it arrives, and once it has seen the headers it knows
(without processing the rest of the message) that it wants to reject this
message.  The receiver sends the REJECT disposition and settles the
transfer.  At this point the sender of the message knows that it is
pointless to send any more of the message so it can abort.

In credit accounting terms there is no reason why this case should be
treated differently than if the receiver didn't reject before it received
the whole of the message, or if the sender decided to carry on sending the
message even though it knows that the receiver has metaphorically stuck its
fingers in its ears and is going "nah nah nah can't hear you".

-- Rob

> Cheers,
> Alan.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message