Polish "Add support for configuring missingQueuesFatal property"
Closes gh-14252
This commit is contained in:
@@ -116,6 +116,9 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
|
||||
if (configuration.getIdleEventInterval() != null) {
|
||||
factory.setIdleEventInterval(configuration.getIdleEventInterval().toMillis());
|
||||
}
|
||||
if (configuration.getMissingQueuesFatal() != null) {
|
||||
factory.setMissingQueuesFatal(configuration.getMissingQueuesFatal());
|
||||
}
|
||||
ListenerRetry retryConfig = configuration.getRetry();
|
||||
if (retryConfig.isEnabled()) {
|
||||
RetryInterceptorBuilder<?> builder = (retryConfig.isStateless())
|
||||
|
||||
@@ -40,8 +40,6 @@ public final class DirectRabbitListenerContainerFactoryConfigurer extends
|
||||
configure(factory, connectionFactory, config);
|
||||
map.from(config::getConsumersPerQueue).whenNonNull()
|
||||
.to(factory::setConsumersPerQueue);
|
||||
map.from(config::getMissingQueuesFatal).whenNonNull()
|
||||
.to(factory::setMissingQueuesFatal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -592,6 +592,12 @@ public class RabbitProperties {
|
||||
*/
|
||||
private Duration idleEventInterval;
|
||||
|
||||
/**
|
||||
* Whether to fail if the queues declared by the container are not available on
|
||||
* the broker.
|
||||
*/
|
||||
private Boolean missingQueuesFatal;
|
||||
|
||||
/**
|
||||
* Optional properties for a retry interceptor.
|
||||
*/
|
||||
@@ -637,6 +643,14 @@ public class RabbitProperties {
|
||||
this.idleEventInterval = idleEventInterval;
|
||||
}
|
||||
|
||||
public Boolean getMissingQueuesFatal() {
|
||||
return this.missingQueuesFatal;
|
||||
}
|
||||
|
||||
public void setMissingQueuesFatal(Boolean missingQueuesFatal) {
|
||||
this.missingQueuesFatal = missingQueuesFatal;
|
||||
}
|
||||
|
||||
public ListenerRetry getRetry() {
|
||||
return this.retry;
|
||||
}
|
||||
@@ -665,13 +679,6 @@ public class RabbitProperties {
|
||||
*/
|
||||
private Integer transactionSize;
|
||||
|
||||
/**
|
||||
* Whether the context should be ended up with failure if there are no any queues
|
||||
* available on the broker or the container should be stopped if queues have been
|
||||
* removed while the container is running.
|
||||
*/
|
||||
private Boolean missingQueuesFatal;
|
||||
|
||||
public Integer getConcurrency() {
|
||||
return this.concurrency;
|
||||
}
|
||||
@@ -696,14 +703,6 @@ public class RabbitProperties {
|
||||
this.transactionSize = transactionSize;
|
||||
}
|
||||
|
||||
public Boolean getMissingQueuesFatal() {
|
||||
return this.missingQueuesFatal;
|
||||
}
|
||||
|
||||
public void setMissingQueuesFatal(Boolean missingQueuesFatal) {
|
||||
this.missingQueuesFatal = missingQueuesFatal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -716,12 +715,6 @@ public class RabbitProperties {
|
||||
*/
|
||||
private Integer consumersPerQueue;
|
||||
|
||||
/**
|
||||
* Whether the context should be ended up with failure if there are no any queues
|
||||
* available on the broker.
|
||||
*/
|
||||
private Boolean missingQueuesFatal;
|
||||
|
||||
public Integer getConsumersPerQueue() {
|
||||
return this.consumersPerQueue;
|
||||
}
|
||||
@@ -730,14 +723,6 @@ public class RabbitProperties {
|
||||
this.consumersPerQueue = consumersPerQueue;
|
||||
}
|
||||
|
||||
public Boolean getMissingQueuesFatal() {
|
||||
return this.missingQueuesFatal;
|
||||
}
|
||||
|
||||
public void setMissingQueuesFatal(Boolean missingQueuesFatal) {
|
||||
this.missingQueuesFatal = missingQueuesFatal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Template {
|
||||
|
||||
@@ -43,8 +43,6 @@ public final class SimpleRabbitListenerContainerFactoryConfigurer extends
|
||||
map.from(config::getMaxConcurrency).whenNonNull()
|
||||
.to(factory::setMaxConcurrentConsumers);
|
||||
map.from(config::getTransactionSize).whenNonNull().to(factory::setTxSize);
|
||||
map.from(config::getMissingQueuesFatal).whenNonNull()
|
||||
.to(factory::setMissingQueuesFatal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -468,8 +468,8 @@ public class RabbitAutoConfigurationTests {
|
||||
"spring.rabbitmq.listener.simple.maxConcurrency:10",
|
||||
"spring.rabbitmq.listener.simple.prefetch:40",
|
||||
"spring.rabbitmq.listener.simple.defaultRequeueRejected:false",
|
||||
"spring.rabbitmq.listener.simple.missingQueuesFatal:false",
|
||||
"spring.rabbitmq.listener.simple.idleEventInterval:5",
|
||||
"spring.rabbitmq.listener.simple.missingQueuesFatal:false",
|
||||
"spring.rabbitmq.listener.simple.transactionSize:20")
|
||||
.run((context) -> {
|
||||
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
||||
@@ -501,8 +501,8 @@ public class RabbitAutoConfigurationTests {
|
||||
"spring.rabbitmq.listener.direct.consumers-per-queue:5",
|
||||
"spring.rabbitmq.listener.direct.prefetch:40",
|
||||
"spring.rabbitmq.listener.direct.defaultRequeueRejected:false",
|
||||
"spring.rabbitmq.listener.direct.missingQueuesFatal:false",
|
||||
"spring.rabbitmq.listener.direct.idleEventInterval:5")
|
||||
"spring.rabbitmq.listener.direct.idleEventInterval:5",
|
||||
"spring.rabbitmq.listener.direct.missingQueuesFatal:false")
|
||||
.run((context) -> {
|
||||
DirectRabbitListenerContainerFactory rabbitListenerContainerFactory = context
|
||||
.getBean("rabbitListenerContainerFactory",
|
||||
@@ -623,10 +623,10 @@ public class RabbitAutoConfigurationTests {
|
||||
assertThat(dfa.getPropertyValue("prefetchCount")).isEqualTo(40);
|
||||
assertThat(dfa.getPropertyValue("messageConverter"))
|
||||
.isSameAs(context.getBean("myMessageConverter"));
|
||||
assertThat(dfa.getPropertyValue("missingQueuesFatal")).isEqualTo(false);
|
||||
assertThat(dfa.getPropertyValue("defaultRequeueRejected"))
|
||||
.isEqualTo(Boolean.FALSE);
|
||||
assertThat(dfa.getPropertyValue("idleEventInterval")).isEqualTo(5L);
|
||||
assertThat(dfa.getPropertyValue("missingQueuesFatal")).isEqualTo(false);
|
||||
Advice[] adviceChain = (Advice[]) dfa.getPropertyValue("adviceChain");
|
||||
assertThat(adviceChain).isNotNull();
|
||||
assertThat(adviceChain.length).isEqualTo(1);
|
||||
|
||||
@@ -1137,7 +1137,7 @@ content into your application. Rather, pick only the properties that you need.
|
||||
spring.rabbitmq.listener.direct.consumers-per-queue= # Number of consumers per queue.
|
||||
spring.rabbitmq.listener.direct.default-requeue-rejected= # Whether rejected deliveries are re-queued by default.
|
||||
spring.rabbitmq.listener.direct.idle-event-interval= # How often idle container events should be published.
|
||||
spring.rabbitmq.listener.direct.missing-queues-fatal= # Whether the context should be ended up with failure if there are no any queues available on the broker.
|
||||
spring.rabbitmq.listener.direct.missing-queues-fatal= # Whether to fail if the queues declared by the container are not available on the broker.
|
||||
spring.rabbitmq.listener.direct.prefetch= # Number of messages to be handled in a single request. It should be greater than or equal to the transaction size (if used).
|
||||
spring.rabbitmq.listener.direct.retry.enabled=false # Whether publishing retries are enabled.
|
||||
spring.rabbitmq.listener.direct.retry.initial-interval=1000ms # Duration between the first and second attempt to deliver a message.
|
||||
@@ -1151,7 +1151,7 @@ content into your application. Rather, pick only the properties that you need.
|
||||
spring.rabbitmq.listener.simple.default-requeue-rejected= # Whether rejected deliveries are re-queued by default.
|
||||
spring.rabbitmq.listener.simple.idle-event-interval= # How often idle container events should be published.
|
||||
spring.rabbitmq.listener.simple.max-concurrency= # Maximum number of listener invoker threads.
|
||||
spring.rabbitmq.listener.simple.missing-queues-fatal= # Whether the context should be ended up with failure if there are no any queues available on the broker or the container should be stopped if queues have been removed while the container is running.
|
||||
spring.rabbitmq.listener.simple.missing-queues-fatal= # Whether to fail if the queues declared by the container are not available on the broker.
|
||||
spring.rabbitmq.listener.simple.prefetch= # Number of messages to be handled in a single request. It should be greater than or equal to the transaction size (if used).
|
||||
spring.rabbitmq.listener.simple.retry.enabled=false # Whether publishing retries are enabled.
|
||||
spring.rabbitmq.listener.simple.retry.initial-interval=1000ms # Duration between the first and second attempt to deliver a message.
|
||||
|
||||
Reference in New Issue
Block a user