|
|
|
@ -19,10 +19,13 @@ package org.springframework.boot.autoconfigure.amqp;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
|
|
|
|
|
import org.springframework.amqp.rabbit.config.ContainerCustomizer;
|
|
|
|
|
import org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory;
|
|
|
|
|
import org.springframework.amqp.rabbit.config.RabbitListenerConfigUtils;
|
|
|
|
|
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
|
|
|
|
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
|
|
|
|
import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
|
|
|
|
|
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
|
|
|
|
import org.springframework.amqp.rabbit.retry.MessageRecoverer;
|
|
|
|
|
import org.springframework.amqp.support.converter.MessageConverter;
|
|
|
|
|
import org.springframework.beans.factory.ObjectProvider;
|
|
|
|
@ -48,14 +51,23 @@ class RabbitAnnotationDrivenConfiguration {
|
|
|
|
|
|
|
|
|
|
private final ObjectProvider<RabbitRetryTemplateCustomizer> retryTemplateCustomizers;
|
|
|
|
|
|
|
|
|
|
private final ObjectProvider<ContainerCustomizer<SimpleMessageListenerContainer>> simpleContainerCustomizer;
|
|
|
|
|
|
|
|
|
|
private final ObjectProvider<ContainerCustomizer<DirectMessageListenerContainer>> directContainerCustomizer;
|
|
|
|
|
|
|
|
|
|
private final RabbitProperties properties;
|
|
|
|
|
|
|
|
|
|
RabbitAnnotationDrivenConfiguration(ObjectProvider<MessageConverter> messageConverter,
|
|
|
|
|
ObjectProvider<MessageRecoverer> messageRecoverer,
|
|
|
|
|
ObjectProvider<RabbitRetryTemplateCustomizer> retryTemplateCustomizers, RabbitProperties properties) {
|
|
|
|
|
ObjectProvider<RabbitRetryTemplateCustomizer> retryTemplateCustomizers,
|
|
|
|
|
ObjectProvider<ContainerCustomizer<SimpleMessageListenerContainer>> simpleContainerCustomizer,
|
|
|
|
|
ObjectProvider<ContainerCustomizer<DirectMessageListenerContainer>> directContainerCustomizer,
|
|
|
|
|
RabbitProperties properties) {
|
|
|
|
|
this.messageConverter = messageConverter;
|
|
|
|
|
this.messageRecoverer = messageRecoverer;
|
|
|
|
|
this.retryTemplateCustomizers = retryTemplateCustomizers;
|
|
|
|
|
this.simpleContainerCustomizer = simpleContainerCustomizer;
|
|
|
|
|
this.directContainerCustomizer = directContainerCustomizer;
|
|
|
|
|
this.properties = properties;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -79,6 +91,7 @@ class RabbitAnnotationDrivenConfiguration {
|
|
|
|
|
SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) {
|
|
|
|
|
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
|
|
|
|
|
configurer.configure(factory, connectionFactory);
|
|
|
|
|
this.simpleContainerCustomizer.ifUnique(factory::setContainerCustomizer);
|
|
|
|
|
return factory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -101,6 +114,7 @@ class RabbitAnnotationDrivenConfiguration {
|
|
|
|
|
DirectRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) {
|
|
|
|
|
DirectRabbitListenerContainerFactory factory = new DirectRabbitListenerContainerFactory();
|
|
|
|
|
configurer.configure(factory, connectionFactory);
|
|
|
|
|
this.directContainerCustomizer.ifUnique(factory::setContainerCustomizer);
|
|
|
|
|
return factory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|