Deprecate spring.rabbitmq.template.queue
Closes gh-15301
This commit is contained in:
@@ -196,7 +196,7 @@ public class RabbitAutoConfiguration {
|
||||
.to(template::setReplyTimeout);
|
||||
map.from(properties::getExchange).to(template::setExchange);
|
||||
map.from(properties::getRoutingKey).to(template::setRoutingKey);
|
||||
map.from(properties::getQueue).whenNonNull()
|
||||
map.from(properties::getDefaultReceiveQueue).whenNonNull()
|
||||
.to(template::setDefaultReceiveQueue);
|
||||
return template;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import org.springframework.amqp.core.AcknowledgeMode;
|
||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory.CacheMode;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
|
||||
import org.springframework.boot.convert.DurationUnit;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -776,7 +777,7 @@ public class RabbitProperties {
|
||||
* Name of the default queue to receive messages from when none is specified
|
||||
* explicitly.
|
||||
*/
|
||||
private String queue;
|
||||
private String defaultReceiveQueue;
|
||||
|
||||
public Retry getRetry() {
|
||||
return this.retry;
|
||||
@@ -822,12 +823,23 @@ public class RabbitProperties {
|
||||
this.routingKey = routingKey;
|
||||
}
|
||||
|
||||
public String getQueue() {
|
||||
return this.queue;
|
||||
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() {
|
||||
return getDefaultReceiveQueue();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setQueue(String queue) {
|
||||
this.queue = queue;
|
||||
setDefaultReceiveQueue(queue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -321,6 +321,19 @@ public class RabbitAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@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() {
|
||||
this.contextRunner.withUserConfiguration(TestConfiguration.class)
|
||||
.withPropertyValues("spring.rabbitmq.template.queue:default-queue")
|
||||
|
||||
@@ -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.validate-server-certificate=true # Whether to enable server side certificate validation.
|
||||
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.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.reply-timeout= # Timeout for `sendAndReceive()` operations.
|
||||
spring.rabbitmq.template.retry.enabled=false # Whether publishing retries are enabled.
|
||||
|
||||
Reference in New Issue
Block a user