Reputation: 11
Do we need to set useConfirmHeader
to true
in the application.yml file if we want to enable publisher confirms using Spring Cloud Stream Rabbit Binder?
Seems publisher-confirms
still work perfectly even if we remove this useConfirmHeader
setting:
spring.cloud.stream.rabbit.bindings.output-out-0.producer.useConfirmHeader=true
Do we still need such a setting? When is it necessary?
Reference link: https://docs.spring.io/spring-cloud-stream/reference/rabbit/rabbit_overview/publisher-confirms.html#page-title
Upvotes: 1
Views: 21
Reputation: 121552
That's correct because the logic there is like this:
buildRabbitTemplate(extendedProperties,
errorChannel != null || extendedProperties.isUseConfirmHeader()));
Which donates to the mandatory
. So, or this, or errorChannelEnabled
, or errorHandlerDefinition
is provided.
I don't see how else mandatory
is set to true
.
However see its JavaDocs:
/**
* When true, the binding will complete the {@link java.util.concurrent.Future} field
* in a {@link org.springframework.amqp.rabbit.connection.CorrelationData} contained
* in the
* {@link org.springframework.amqp.support.AmqpHeaders#PUBLISH_CONFIRM_CORRELATION}
* header when the confirmation is received.
*/
private boolean useConfirmHeader;
But I don't see that such a header is set somehow in Rabbit Binder. It is used from the AbstractAmqpOutboundEndpoint
to extract user correlation data, but that's it. This useConfirmHeader
has not effect on a header interaction.
I believe the purpose of this option is cosmetic to indicate that confirms are going to be handled by the value in the AmqpHeaders.PUBLISH_CONFIRM_CORRELATION
header.
Its further logic is to be mutually exclusive with a confirmAckChannel
:
Assert.state(!StringUtils.hasText(extendedProperties.getConfirmAckChannel()),
"You cannot specify a 'confirmAckChannel' when 'useConfirmHeader' is true");
Which has been removed for a while.
Upvotes: 0