GH-11194: Use simple confirms in AmqpOutboundEndpoint - #11205
Open
xxxxxxjun wants to merge 1 commit into
Open
Conversation
Fixes: spring-projects#11194 The `waitForConfirm` option only took effect when the message carried `CorrelationData`, which requires a connection factory configured for correlated publisher confirms. With `ConfirmType.SIMPLE` there is no correlation data, so the option was silently ignored for single messages, even though the `multiSend` path already used Spring AMQP's scoped `waitForConfirmsOrDie()` for iterable payloads. * Send within a `RabbitTemplate.invoke()` scope and call `waitForConfirmsOrDie()` when `waitForConfirm` is true, there is no correlation data and the connection factory is configured for simple publisher confirms * Warn in `endpointInit()` when `waitForConfirm` is set but the connection factory supports no publisher confirms at all, instead of ignoring the option silently * Correct the `setWaitForConfirm()` Javadoc, the XSD and the reference manual, which stated that a `confirm-correlation-expression` is always required * Add `simpleConfirmsOk()` and `simpleConfirmsWithReject()` to `AmqpOutboundEndpointTests2` Signed-off-by: Jun Cho <ryuu.public@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #11194
waitForConfirmis ignored for single messages withConfirmType.SIMPLE, since it only acts when the message carriesCorrelationData. As you suggested in #11187, the send now runs inside aRabbitTemplate.invoke()scope withwaitForConfirmsOrDie()at the end whenwaitForConfirmis true and there is no correlation data, the same waymultiSenddoes.Two decisions the issue does not cover:
isSimplePublisherConfirms(), soCORRELATEDandNONEfactories keep their current behavior.setMultiSend()andBoundRabbitChannelAdvicealready require the same.endpointInit()warns whenwaitForConfirmis set on a factory with no publisher confirms at all, which was previously ignored without a signal.Documented on the option: a returned message does not fail the send, since the broker acks an unroutable mandatory publish; and the scoped send cannot be combined with a
BoundRabbitChannelAdviceon the sameRabbitTemplate.