Skip to content

GH-11194: Use simple confirms in AmqpOutboundEndpoint - #11205

Open
xxxxxxjun wants to merge 1 commit into
spring-projects:mainfrom
xxxxxxjun:GH-11194
Open

GH-11194: Use simple confirms in AmqpOutboundEndpoint#11205
xxxxxxjun wants to merge 1 commit into
spring-projects:mainfrom
xxxxxxjun:GH-11194

Conversation

@xxxxxxjun

Copy link
Copy Markdown

Fixes #11194

waitForConfirm is ignored for single messages with ConfirmType.SIMPLE, since it only acts when the message carries CorrelationData. As you suggested in #11187, the send now runs inside a RabbitTemplate.invoke() scope with waitForConfirmsOrDie() at the end when waitForConfirm is true and there is no correlation data, the same way multiSend does.

Two decisions the issue does not cover:

  • The branch is also guarded on isSimplePublisherConfirms(), so CORRELATED and NONE factories keep their current behavior. setMultiSend() and BoundRabbitChannelAdvice already require the same.
  • endpointInit() warns when waitForConfirm is 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 BoundRabbitChannelAdvice on the same RabbitTemplate.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Options to use simple publisher confirms in AMQP outbound endpoints

1 participant