Require RabbitMQ publisher confirms#1727
Open
rolandbeisel wants to merge 3 commits into
Open
Conversation
Signed-off-by: Roland Beisel <info@rolandbeisel.de>
Signed-off-by: Roland Beisel <info@rolandbeisel.de>
Signed-off-by: Roland Beisel <info@rolandbeisel.de>
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.
Require RabbitMQ Publisher Confirms for Event Externalization
Summary
RabbitMQ outbox event externalization previously considered a publish successful as soon as
RabbitMessageOperations.convertAndSend(…)returned.That call reports failures which can be detected synchronously, including failures to establish a broker connection,
authentication failures, connection or channel creation failures, and synchronous I/O failures during publishing.
However, a successful return does not confirm that RabbitMQ accepted the individual publish. For example, the
connection can fail immediately after the local write, or the broker can asynchronously reject the publish.
This change requires correlated RabbitMQ publisher confirms for outbox mode. RabbitMQ outbox externalization is now
only considered successful after a positive publisher confirm.
The default module-listener mode remains unchanged and does not require publisher confirms.
Changes
Require the following configuration when RabbitMQ is used in outbox mode:
spring.rabbitmq.publisher-confirm-type=correlatedFail application startup with a clear error when correlated publisher confirms are missing in RabbitMQ outbox mode.
Create a unique
CorrelationDatainstance for every RabbitMQ outbox publish.Pass the correlation data through
AmqpHeaders.PUBLISH_CONFIRM_CORRELATION.Complete the outbox transport future only after receiving a positive publisher confirm.
Complete the transport future exceptionally after receiving a publisher nack.
Continue propagating synchronous failures from
convertAndSend(…)as failed transport futures.Keep module-listener publishing fire-and-forget and independent of publisher-confirm configuration.
Document the RabbitMQ outbox configuration requirement and delivery guarantee.
Correct copied Kafka bean names in the RabbitMQ and Spring Messaging outbox configurations.
Failure Scenarios
Included
The following scenarios prevent RabbitMQ outbox externalization from being considered successful:
basicPublish(…)encounters a synchronous I/O failure.convertAndSend(…)otherwise fails synchronously.Synchronous failures are propagated through the transport's failed
CompletableFuture. Publisher nacks also completethe future exceptionally. Blocking outbox integrations receive those failures through
externalizeBlocking(…), whileasynchronous callers can observe the returned future.
Not Included
This change intentionally does not cover:
Publisher returns and mandatory publishing are separate concerns from confirming that RabbitMQ accepted a publish and
remain outside the scope of this change.
Tests
Added or updated tests verify that:
convertAndSend(…)failures produce failed transport futures.CorrelationDatais passed throughAmqpHeaders.PUBLISH_CONFIRM_CORRELATION.Verification