Enforce correct transfer settled flag #12371
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For messages published to RabbitMQ, RabbitMQ honors the transfer
settled
field, no matter what value the sender settle mode was set to in the attach frame.Therefore, prior to this commit, a client could send a transfer with
settled=true
even though sender settle mode was set tounsettled
in the attach frame.This commit enforces that the publisher sets only transfer
settled
fields that are valid with the spec.If sender settle mode is:
unsettled
, the transfersettled
flag must befalse
.settled
, the transfersettled
flag must betrue
.mixed
, the transfersettled
flag can betrue
orfalse
.This PR also fixes a bug in the AMQP 1.0 shovel:
The shovel violated the AMQP 1.0 spec by sending transfers with
settled=true
under sender settle modeunsettled
if shovelack-mode
is set toon-publish
.This PR will break shovels if:
ack-mode
valueon-publish
Given all three combinations combined are extremely rare,
on-publish
alone is already a rare setting (on-confirm
which is the default, orno-ack
make much more sense thanon-publish
), I think it's fine to backport this PR tov4.0.x
. In case someone hits this combination, the user can change theack-mode
.