From d7a7bbbf75f1bcd08ec76a2289d36c1a48950cf8 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 30 Jul 2021 11:39:45 -0400 Subject: [PATCH] GH-3601: Bring AMQP byte code compatibility back Fixes https://github.com/spring-projects/spring-integration/issues/3601 The issue https://github.com/spring-projects/spring-integration/issues/3584 has introduced a regression when old constructor with an `AbstractMessageListenerContainer` was removed in favor of just `MessageListenerContainer`. But with that change all the dependant projects must be recompiled, which is not a case when Spring Cloud was not released against the latest Spring Boot. **Cherry-pick to `5.4.x`** --- .../amqp/inbound/AmqpInboundChannelAdapter.java | 5 +++++ .../amqp/inbound/AmqpInboundGateway.java | 13 ++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.java index e21aeb0205..80a01ac556 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundChannelAdapter.java @@ -119,6 +119,11 @@ public class AmqpInboundChannelAdapter extends MessageProducerSupport implements private BatchMode batchMode = BatchMode.MESSAGES; + // TODO Remove in 6.0 + public AmqpInboundChannelAdapter(AbstractMessageListenerContainer listenerContainer) { + this((MessageListenerContainer) listenerContainer); + } + /** * Construct an instance using the provided container. * @param listenerContainer the container. diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java index 7b865e3ce5..4b36abd0b5 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java @@ -98,12 +98,23 @@ public class AmqpInboundGateway extends MessagingGatewaySupport { this(listenerContainer, new RabbitTemplate(listenerContainer.getConnectionFactory()), false); } + // TODO Remove in 6.0 + /** + * Construct {@link AmqpInboundGateway} based on the provided {@link AbstractMessageListenerContainer} + * to receive request messages and {@link AmqpTemplate} to send replies. + * @param listenerContainer the {@link MessageListenerContainer} to receive AMQP messages. + * @param amqpTemplate the {@link AmqpTemplate} to send reply messages. + * @since 4.2 + */ + public AmqpInboundGateway(AbstractMessageListenerContainer listenerContainer, AmqpTemplate amqpTemplate) { + this((MessageListenerContainer) listenerContainer, amqpTemplate); + } + /** * Construct {@link AmqpInboundGateway} based on the provided {@link MessageListenerContainer} * to receive request messages and {@link AmqpTemplate} to send replies. * @param listenerContainer the {@link MessageListenerContainer} to receive AMQP messages. * @param amqpTemplate the {@link AmqpTemplate} to send reply messages. - * @since 4.2 */ public AmqpInboundGateway(MessageListenerContainer listenerContainer, AmqpTemplate amqpTemplate) { this(listenerContainer, amqpTemplate, true);