|
23 | 23 | import com.rabbitmq.client.amqp.impl.AmqpEnvironmentBuilder.EnvironmentConnectionSettings;
|
24 | 24 |
|
25 | 25 | import org.springframework.amqp.rabbit.config.ContainerCustomizer;
|
26 |
| -import org.springframework.amqp.rabbit.config.RetryInterceptorBuilder; |
27 | 26 | import org.springframework.amqp.rabbit.retry.MessageRecoverer;
|
28 |
| -import org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer; |
29 | 27 | import org.springframework.amqp.rabbitmq.client.AmqpConnectionFactory;
|
30 | 28 | import org.springframework.amqp.rabbitmq.client.RabbitAmqpAdmin;
|
31 | 29 | import org.springframework.amqp.rabbitmq.client.RabbitAmqpTemplate;
|
|
35 | 33 | import org.springframework.amqp.support.converter.MessageConverter;
|
36 | 34 | import org.springframework.beans.factory.ObjectProvider;
|
37 | 35 | import org.springframework.boot.amqp.autoconfigure.RabbitConnectionDetails.Address;
|
38 |
| -import org.springframework.boot.amqp.autoconfigure.RabbitProperties.ListenerRetry; |
39 |
| -import org.springframework.boot.amqp.autoconfigure.RabbitRetryTemplateCustomizer.Target; |
40 | 36 | import org.springframework.boot.autoconfigure.AutoConfiguration;
|
41 | 37 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
42 | 38 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
45 | 41 | import org.springframework.boot.context.properties.PropertyMapper;
|
46 | 42 | import org.springframework.boot.ssl.SslBundles;
|
47 | 43 | import org.springframework.context.annotation.Bean;
|
48 |
| -import org.springframework.retry.support.RetryTemplate; |
49 | 44 |
|
50 | 45 | /**
|
51 | 46 | * {@link EnableAutoConfiguration Auto-configuration} for {@link RabbitAmqpTemplate}.
|
52 | 47 | *
|
53 | 48 | * @author Eddú Meléndez
|
54 | 49 | * @since 4.0.0
|
55 | 50 | */
|
56 |
| -@AutoConfiguration |
| 51 | +@AutoConfiguration(before = RabbitAutoConfiguration.class) |
57 | 52 | @ConditionalOnClass({ RabbitAmqpTemplate.class, Connection.class })
|
58 | 53 | @EnableConfigurationProperties(RabbitProperties.class)
|
59 | 54 | public final class RabbitAmqpAutoConfiguration {
|
@@ -82,20 +77,6 @@ RabbitAmqpListenerContainerFactory rabbitAmqpListenerContainerFactory(
|
82 | 77 |
|
83 | 78 | RabbitProperties.AmqpContainer configuration = this.properties.getListener().getSimple();
|
84 | 79 | factory.setObservationEnabled(configuration.isObservationEnabled());
|
85 |
| - ListenerRetry retryConfig = configuration.getRetry(); |
86 |
| - if (retryConfig.isEnabled()) { |
87 |
| - RetryInterceptorBuilder<?, ?> builder = (retryConfig.isStateless()) ? RetryInterceptorBuilder.stateless() |
88 |
| - : RetryInterceptorBuilder.stateful(); |
89 |
| - |
90 |
| - RetryTemplate retryTemplate = new RetryTemplateFactory(retryTemplateCustomizers.orderedStream().toList()) |
91 |
| - .createRetryTemplate(retryConfig, Target.LISTENER); |
92 |
| - |
93 |
| - builder.retryOperations(retryTemplate); |
94 |
| - MessageRecoverer recoverer = (messageRecoverer.getIfAvailable() != null) ? messageRecoverer.getIfAvailable() |
95 |
| - : new RejectAndDontRequeueRecoverer(); |
96 |
| - builder.recoverer(recoverer); |
97 |
| - factory.setAdviceChain(builder.build()); |
98 |
| - } |
99 | 80 | return factory;
|
100 | 81 | }
|
101 | 82 |
|
@@ -123,7 +104,7 @@ Environment rabbitAmqpEnvironment(RabbitConnectionDetails connectionDetails,
|
123 | 104 |
|
124 | 105 | @Bean
|
125 | 106 | @ConditionalOnMissingBean
|
126 |
| - AmqpConnectionFactory amqpConnection(Environment environment) { |
| 107 | + AmqpConnectionFactory amqpConnectionFactory(Environment environment) { |
127 | 108 | return new SingleAmqpConnectionFactory(environment);
|
128 | 109 | }
|
129 | 110 |
|
|
0 commit comments