GH-2483: RMQ: Fix Redeclare Multi Routing Keys
Resolves https://github.com/spring-cloud/spring-cloud-stream/issues/2483 https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit/issues/242 added support for binding a queue with multiple routing keys. However, only one binding was added to the `autoRedeclarContext`. Use the `Declarables` wrapper to support multiple instances with the same name. **cherry-pick to 3.2.x** Resolves #2484
This commit is contained in:
committed by
Oleg Zhurakousky
parent
71ee26b0a1
commit
f7146ad02e
@@ -59,6 +59,7 @@ import org.springframework.amqp.core.AnonymousQueue;
|
||||
import org.springframework.amqp.core.Binding.DestinationType;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.Declarable;
|
||||
import org.springframework.amqp.core.Declarables;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
import org.springframework.amqp.core.MessageDeliveryMode;
|
||||
@@ -163,7 +164,7 @@ public class RabbitBinderTests extends
|
||||
private static final String BIG_EXCEPTION_MESSAGE = new String(new byte[10_000]).replaceAll("\u0000", "x");
|
||||
|
||||
@RegisterExtension
|
||||
private RabbitTestSupport rabbitTestSupport = new RabbitTestSupport(true, RABBITMQ.getAmqpPort(), RABBITMQ.getHttpPort());
|
||||
private final RabbitTestSupport rabbitTestSupport = new RabbitTestSupport(true, RABBITMQ.getAmqpPort(), RABBITMQ.getHttpPort());
|
||||
|
||||
private int maxStackTraceSize;
|
||||
|
||||
@@ -602,6 +603,10 @@ public class RabbitBinderTests extends
|
||||
SimpleMessageListenerContainer container = TestUtils.getPropertyValue(endpoint,
|
||||
"messageListenerContainer", SimpleMessageListenerContainer.class);
|
||||
assertThat(container.isRunning()).isTrue();
|
||||
ApplicationContext ctx =
|
||||
TestUtils.getPropertyValue(binder, "binder.provisioningProvider.autoDeclareContext",
|
||||
ApplicationContext.class);
|
||||
assertThat(ctx.getBean("infra.binding", Declarables.class).getDeclarables()).hasSize(2);
|
||||
consumerBinding.unbind();
|
||||
assertThat(container.isRunning()).isFalse();
|
||||
assertThat(container.getQueueNames()[0]).isEqualTo(group);
|
||||
|
||||
Reference in New Issue
Block a user