Commit 8928cd19 authored by Stephane Nicoll's avatar Stephane Nicoll

Deprecate spring.rabbitmq.template.queue

Closes gh-15301
parent a240e225
...@@ -196,7 +196,7 @@ public class RabbitAutoConfiguration { ...@@ -196,7 +196,7 @@ public class RabbitAutoConfiguration {
.to(template::setReplyTimeout); .to(template::setReplyTimeout);
map.from(properties::getExchange).to(template::setExchange); map.from(properties::getExchange).to(template::setExchange);
map.from(properties::getRoutingKey).to(template::setRoutingKey); map.from(properties::getRoutingKey).to(template::setRoutingKey);
map.from(properties::getQueue).whenNonNull() map.from(properties::getDefaultReceiveQueue).whenNonNull()
.to(template::setDefaultReceiveQueue); .to(template::setDefaultReceiveQueue);
return template; return template;
} }
......
...@@ -24,6 +24,7 @@ import java.util.List; ...@@ -24,6 +24,7 @@ import java.util.List;
import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
import org.springframework.boot.convert.DurationUnit; import org.springframework.boot.convert.DurationUnit;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -776,7 +777,7 @@ public class RabbitProperties { ...@@ -776,7 +777,7 @@ public class RabbitProperties {
* Name of the default queue to receive messages from when none is specified * Name of the default queue to receive messages from when none is specified
* explicitly. * explicitly.
*/ */
private String queue; private String defaultReceiveQueue;
public Retry getRetry() { public Retry getRetry() {
return this.retry; return this.retry;
...@@ -822,12 +823,23 @@ public class RabbitProperties { ...@@ -822,12 +823,23 @@ public class RabbitProperties {
this.routingKey = routingKey; this.routingKey = routingKey;
} }
public String getDefaultReceiveQueue() {
return this.defaultReceiveQueue;
}
public void setDefaultReceiveQueue(String defaultReceiveQueue) {
this.defaultReceiveQueue = defaultReceiveQueue;
}
@Deprecated
@DeprecatedConfigurationProperty(replacement = "spring.rabbitmq.template.default-receive-queue")
public String getQueue() { public String getQueue() {
return this.queue; return getDefaultReceiveQueue();
} }
@Deprecated
public void setQueue(String queue) { public void setQueue(String queue) {
this.queue = queue; setDefaultReceiveQueue(queue);
} }
} }
......
...@@ -321,6 +321,19 @@ public class RabbitAutoConfigurationTests { ...@@ -321,6 +321,19 @@ public class RabbitAutoConfigurationTests {
} }
@Test @Test
public void testRabbitTemplateDefaultReceiveQueue() {
this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues(
"spring.rabbitmq.template.default-receive-queue:default-queue")
.run((context) -> {
RabbitTemplate rabbitTemplate = context.getBean(RabbitTemplate.class);
assertThat(rabbitTemplate).hasFieldOrPropertyWithValue(
"defaultReceiveQueue", "default-queue");
});
}
@Test
@Deprecated
public void testRabbitTemplateDefaultQueue() { public void testRabbitTemplateDefaultQueue() {
this.contextRunner.withUserConfiguration(TestConfiguration.class) this.contextRunner.withUserConfiguration(TestConfiguration.class)
.withPropertyValues("spring.rabbitmq.template.queue:default-queue") .withPropertyValues("spring.rabbitmq.template.queue:default-queue")
......
...@@ -1180,9 +1180,9 @@ content into your application. Rather, pick only the properties that you need. ...@@ -1180,9 +1180,9 @@ content into your application. Rather, pick only the properties that you need.
spring.rabbitmq.ssl.trust-store-type=JKS # Trust store type. spring.rabbitmq.ssl.trust-store-type=JKS # Trust store type.
spring.rabbitmq.ssl.validate-server-certificate=true # Whether to enable server side certificate validation. spring.rabbitmq.ssl.validate-server-certificate=true # Whether to enable server side certificate validation.
spring.rabbitmq.ssl.verify-hostname=true # Whether to enable hostname verification. spring.rabbitmq.ssl.verify-hostname=true # Whether to enable hostname verification.
spring.rabbitmq.template.default-receive-queue= # Name of the default queue to receive messages from when none is specified explicitly.
spring.rabbitmq.template.exchange= # Name of the default exchange to use for send operations. spring.rabbitmq.template.exchange= # Name of the default exchange to use for send operations.
spring.rabbitmq.template.mandatory= # Whether to enable mandatory messages. spring.rabbitmq.template.mandatory= # Whether to enable mandatory messages.
spring.rabbitmq.template.queue= # Name of the default queue to receive messages from when none is specified explicitly.
spring.rabbitmq.template.receive-timeout= # Timeout for `receive()` operations. spring.rabbitmq.template.receive-timeout= # Timeout for `receive()` operations.
spring.rabbitmq.template.reply-timeout= # Timeout for `sendAndReceive()` operations. spring.rabbitmq.template.reply-timeout= # Timeout for `sendAndReceive()` operations.
spring.rabbitmq.template.retry.enabled=false # Whether publishing retries are enabled. spring.rabbitmq.template.retry.enabled=false # Whether publishing retries are enabled.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment