Pass required settings into Rabbit LCF configurer's constructor

Closes gh-27311
pull/30691/head
Andy Wilkinson 3 years ago
parent 659667bb65
commit e6141c04f6

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,6 +47,25 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
private RabbitProperties rabbitProperties;
/**
* Creates a new configurer.
* @deprecated since 2.6.0 for removal in 2.8.0 in favor of
* {@link #AbstractRabbitListenerContainerFactoryConfigurer(RabbitProperties)}
*/
@Deprecated
protected AbstractRabbitListenerContainerFactoryConfigurer() {
}
/**
* Creates a new configurer that will use the given {@code rabbitProperties}.
* @param rabbitProperties properties to use
* @since 2.6.0
*/
protected AbstractRabbitListenerContainerFactoryConfigurer(RabbitProperties rabbitProperties) {
this.rabbitProperties = rabbitProperties;
}
/**
* Set the {@link MessageConverter} to use or {@code null} if the out-of-the-box
* converter should be used.
@ -75,7 +94,10 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer<T extends
/**
* Set the {@link RabbitProperties} to use.
* @param rabbitProperties the {@link RabbitProperties}
* @deprecated since 2.6.0 for removal in 2.8.0 in favor of
* {@link #AbstractRabbitListenerContainerFactoryConfigurer(RabbitProperties)}
*/
@Deprecated
protected void setRabbitProperties(RabbitProperties rabbitProperties) {
this.rabbitProperties = rabbitProperties;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,6 +31,25 @@ import org.springframework.boot.context.properties.PropertyMapper;
public final class DirectRabbitListenerContainerFactoryConfigurer
extends AbstractRabbitListenerContainerFactoryConfigurer<DirectRabbitListenerContainerFactory> {
/**
* Creates a new configurer.
* @deprecated since 2.6.0 for removal in 2.8.0 in favor of
* {@link #DirectRabbitListenerContainerFactoryConfigurer(RabbitProperties)}
*/
@Deprecated
public DirectRabbitListenerContainerFactoryConfigurer() {
super();
}
/**
* Creates a new configurer that will use the given {@code rabbitProperties}.
* @param rabbitProperties properties to use
* @since 2.6.0
*/
public DirectRabbitListenerContainerFactoryConfigurer(RabbitProperties rabbitProperties) {
super(rabbitProperties);
}
@Override
public void configure(DirectRabbitListenerContainerFactory factory, ConnectionFactory connectionFactory) {
PropertyMapper map = PropertyMapper.get();

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -62,12 +62,12 @@ class RabbitAnnotationDrivenConfiguration {
@Bean
@ConditionalOnMissingBean
SimpleRabbitListenerContainerFactoryConfigurer simpleRabbitListenerContainerFactoryConfigurer() {
SimpleRabbitListenerContainerFactoryConfigurer configurer = new SimpleRabbitListenerContainerFactoryConfigurer();
SimpleRabbitListenerContainerFactoryConfigurer configurer = new SimpleRabbitListenerContainerFactoryConfigurer(
this.properties);
configurer.setMessageConverter(this.messageConverter.getIfUnique());
configurer.setMessageRecoverer(this.messageRecoverer.getIfUnique());
configurer.setRetryTemplateCustomizers(
this.retryTemplateCustomizers.orderedStream().collect(Collectors.toList()));
configurer.setRabbitProperties(this.properties);
return configurer;
}
@ -85,12 +85,12 @@ class RabbitAnnotationDrivenConfiguration {
@Bean
@ConditionalOnMissingBean
DirectRabbitListenerContainerFactoryConfigurer directRabbitListenerContainerFactoryConfigurer() {
DirectRabbitListenerContainerFactoryConfigurer configurer = new DirectRabbitListenerContainerFactoryConfigurer();
DirectRabbitListenerContainerFactoryConfigurer configurer = new DirectRabbitListenerContainerFactoryConfigurer(
this.properties);
configurer.setMessageConverter(this.messageConverter.getIfUnique());
configurer.setMessageRecoverer(this.messageRecoverer.getIfUnique());
configurer.setRetryTemplateCustomizers(
this.retryTemplateCustomizers.orderedStream().collect(Collectors.toList()));
configurer.setRabbitProperties(this.properties);
return configurer;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -31,6 +31,25 @@ import org.springframework.boot.context.properties.PropertyMapper;
public final class SimpleRabbitListenerContainerFactoryConfigurer
extends AbstractRabbitListenerContainerFactoryConfigurer<SimpleRabbitListenerContainerFactory> {
/**
* Creates a new configurer.
* @deprecated since 2.6.0 for removal in 2.8.0 in favor of
* {@link #SimpleRabbitListenerContainerFactoryConfigurer(RabbitProperties)}
*/
@Deprecated
public SimpleRabbitListenerContainerFactoryConfigurer() {
super();
}
/**
* Creates a new configurer that will use the given {@code rabbitProperties}.
* @param rabbitProperties properties to use
* @since 2.6.0
*/
public SimpleRabbitListenerContainerFactoryConfigurer(RabbitProperties rabbitProperties) {
super(rabbitProperties);
}
@Override
public void configure(SimpleRabbitListenerContainerFactory factory, ConnectionFactory connectionFactory) {
PropertyMapper map = PropertyMapper.get();

Loading…
Cancel
Save