RGH-1439: AMQP: Log Warn For Misconfigured Confirm

See https://github.com/spring-projects/spring-amqp/issues/1439

**cherry-pick to 5.5.x*
This commit is contained in:
Gary Russell
2022-03-23 14:53:51 -04:00
committed by Artem Bilan
parent f4a45cc4d0
commit d23afa2203

View File

@@ -137,11 +137,19 @@ public class AmqpOutboundEndpoint extends AbstractAmqpOutboundEndpoint
Assert.notNull(this.rabbitTemplate,
"RabbitTemplate implementation is required for publisher confirms");
this.rabbitTemplate.setConfirmCallback(this);
if (!this.rabbitTemplate.getConnectionFactory().isPublisherConfirms()) {
this.logger.warn("A confirm correlation expression is provided but the underlying connection factory "
+ "does not support correlated delivery confirmations; no confirmations will be received");
}
}
if (getReturnChannel() != null) {
Assert.notNull(this.rabbitTemplate,
"RabbitTemplate implementation is required for publisher confirms");
this.rabbitTemplate.setReturnsCallback(this);
if (!this.rabbitTemplate.getConnectionFactory().isPublisherReturns()) {
this.logger.warn("A return channel is provided but the underlying connection factory "
+ "does not support returned messages; none will be received");
}
}
Duration confirmTimeout = getConfirmTimeout();
if (confirmTimeout != null) {