Polish "Make RabbitTemplate exchange and routingKey configurable"
Closes gh-10978
This commit is contained in:
@@ -190,7 +190,6 @@ public class RabbitAutoConfiguration {
|
||||
}
|
||||
rabbitTemplate.setExchange(templateProperties.getExchange());
|
||||
rabbitTemplate.setRoutingKey(templateProperties.getRoutingKey());
|
||||
rabbitTemplate.setChannelTransacted(templateProperties.isChannelTransacted());
|
||||
return rabbitTemplate;
|
||||
}
|
||||
|
||||
|
||||
@@ -713,11 +713,6 @@ public class RabbitProperties {
|
||||
*/
|
||||
private String routingKey = "";
|
||||
|
||||
/**
|
||||
* Enable transactional channels.
|
||||
*/
|
||||
private boolean channelTransacted;
|
||||
|
||||
public Retry getRetry() {
|
||||
return this.retry;
|
||||
}
|
||||
@@ -762,14 +757,6 @@ public class RabbitProperties {
|
||||
this.routingKey = routingKey;
|
||||
}
|
||||
|
||||
public boolean isChannelTransacted() {
|
||||
return this.channelTransacted;
|
||||
}
|
||||
|
||||
public void setChannelTransacted(boolean channelTransacted) {
|
||||
this.channelTransacted = channelTransacted;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Retry {
|
||||
|
||||
@@ -113,8 +113,6 @@ public class RabbitAutoConfigurationTests {
|
||||
.isEqualTo(defaultRabbitTemplate.getRoutingKey());
|
||||
assertThat(rabbitTemplate.getExchange())
|
||||
.isEqualTo(defaultRabbitTemplate.getExchange());
|
||||
assertThat(rabbitTemplate.isChannelTransacted())
|
||||
.isEqualTo(defaultRabbitTemplate.isChannelTransacted());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -239,6 +237,18 @@ public class RabbitAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRabbitTemplateExchangeAndRoutingKey() {
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.template.exchange:my-exchange",
|
||||
"spring.rabbitmq.template.routing-key:my-routing-key")
|
||||
.run((context) -> {
|
||||
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
|
||||
assertThat(rabbitTemplate.getExchange()).isEqualTo("my-exchange");
|
||||
assertThat(rabbitTemplate.getRoutingKey()).isEqualTo("my-routing-key");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRabbitTemplateMandatory() {
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
|
||||
Reference in New Issue
Block a user