Remove deprecated classes and methods
This commit is contained in:
committed by
Artem Bilan
parent
ff49223c94
commit
ecb5e113fd
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.amqp.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Interface specifying management operations.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @since 1.5
|
||||
*
|
||||
* @deprecated since 2.1 in favor of direct usage of target REST API client.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface AmqpManagementOperations {
|
||||
|
||||
/**
|
||||
* Add an exchange to the default vhost ('/').
|
||||
* @param exchange the exchange.
|
||||
*/
|
||||
void addExchange(Exchange exchange);
|
||||
|
||||
/**
|
||||
* Add an exchange to the specified vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param exchange the exchange.
|
||||
*/
|
||||
void addExchange(String vhost, Exchange exchange);
|
||||
|
||||
/**
|
||||
* Purge a queue in the default vhost ('/').
|
||||
* @param queue the queue.
|
||||
*/
|
||||
void purgeQueue(Queue queue);
|
||||
|
||||
/**
|
||||
* Purge a queue in the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param queue the queue.
|
||||
*/
|
||||
void purgeQueue(String vhost, Queue queue);
|
||||
|
||||
/**
|
||||
* Delete a queue from the default vhost ('/').
|
||||
* @param queue the queue.
|
||||
*/
|
||||
void deleteQueue(Queue queue);
|
||||
|
||||
/**
|
||||
* Delete a queue from the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param queue the queue.
|
||||
*/
|
||||
void deleteQueue(String vhost, Queue queue);
|
||||
|
||||
/**
|
||||
* Get a specific queue from the default vhost ('/').
|
||||
* @param name the queue name.
|
||||
* @return the Queue.
|
||||
*/
|
||||
Queue getQueue(String name);
|
||||
|
||||
/**
|
||||
* Get a specific queue from the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param name the queue name.
|
||||
* @return the Queue.
|
||||
*/
|
||||
Queue getQueue(String vhost, String name);
|
||||
|
||||
/**
|
||||
* Get all queues.
|
||||
* @return the queues.
|
||||
*/
|
||||
List<Queue> getQueues();
|
||||
|
||||
/**
|
||||
* Get all queues in the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @return the queues.
|
||||
*/
|
||||
List<Queue> getQueues(String vhost);
|
||||
|
||||
/**
|
||||
* Add a queue to the default vhost ('/').
|
||||
* @param queue the queue.
|
||||
*/
|
||||
void addQueue(Queue queue);
|
||||
|
||||
/**
|
||||
* Add a queue to the specified vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param queue the queue.
|
||||
*/
|
||||
void addQueue(String vhost, Queue queue);
|
||||
|
||||
/**
|
||||
* Delete an exchange from the default vhost ('/').
|
||||
* @param exchange the queue.
|
||||
*/
|
||||
void deleteExchange(Exchange exchange);
|
||||
|
||||
/**
|
||||
* Delete an exchange from the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param exchange the queue.
|
||||
*/
|
||||
void deleteExchange(String vhost, Exchange exchange);
|
||||
|
||||
/**
|
||||
* Get a specific queue from the default vhost ('/').
|
||||
* @param name the exchange name.
|
||||
* @return the Exchange.
|
||||
*/
|
||||
Exchange getExchange(String name);
|
||||
|
||||
/**
|
||||
* Get a specific exchange from the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param name the exchange name.
|
||||
* @return the Exchange.
|
||||
*/
|
||||
Exchange getExchange(String vhost, String name);
|
||||
|
||||
/**
|
||||
* Get all exchanges.
|
||||
* @return the exchanges.
|
||||
*/
|
||||
List<Exchange> getExchanges();
|
||||
|
||||
/**
|
||||
* Get all exchanges in the provided vhost. Only {@link DirectExchange},
|
||||
* {@link FanoutExchange}, {@link HeadersExchange} and {@link TopicExchange}s
|
||||
* are returned.
|
||||
* @param vhost the vhost.
|
||||
* @return the exchanges.
|
||||
*/
|
||||
List<Exchange> getExchanges(String vhost);
|
||||
|
||||
/**
|
||||
* Get all bindings.
|
||||
* @return the bindings.
|
||||
*/
|
||||
List<Binding> getBindings();
|
||||
|
||||
/**
|
||||
* Get all bindings in the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @return the bindings.
|
||||
*/
|
||||
List<Binding> getBindings(String vhost);
|
||||
|
||||
/**
|
||||
* Get all bindings from the provided exchange in the provided vhost.
|
||||
* @param vhost the vhost.
|
||||
* @param exchange the exchange name.
|
||||
* @return the bindings.
|
||||
*/
|
||||
List<Binding> getBindingsForExchange(String vhost, String exchange);
|
||||
|
||||
}
|
||||
@@ -16,12 +16,7 @@
|
||||
|
||||
package org.springframework.amqp.core;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
/**
|
||||
* Represents an anonymous, non-durable, exclusive, auto-delete queue. The name has the
|
||||
@@ -50,32 +45,6 @@ public class AnonymousQueue extends Queue {
|
||||
this(org.springframework.amqp.core.Base64UrlNamingStrategy.DEFAULT, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a queue with a name provided by the supplied naming strategy.
|
||||
* @param namingStrategy the naming strategy.
|
||||
* @deprecated in favor of {@link #AnonymousQueue(NamingStrategy)}.
|
||||
*
|
||||
* @since 1.5.3
|
||||
*/
|
||||
@Deprecated
|
||||
public AnonymousQueue(NamingStrategy namingStrategy) {
|
||||
this(namingStrategy, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a queue with a name provided by the supplied naming strategy with the
|
||||
* supplied arguments.
|
||||
* @param namingStrategy the naming strategy.
|
||||
* @param arguments the arguments.
|
||||
* @deprecated in favor of {@link #AnonymousQueue(NamingStrategy, Map)}.
|
||||
*
|
||||
* @since 1.5.3
|
||||
*/
|
||||
@Deprecated
|
||||
public AnonymousQueue(NamingStrategy namingStrategy, Map<String, Object> arguments) {
|
||||
super(namingStrategy.generateName(), false, true, true, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a queue with a name provided by the supplied naming strategy.
|
||||
* @param namingStrategy the naming strategy.
|
||||
@@ -99,87 +68,4 @@ public class AnonymousQueue extends Queue {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A strategy to name anonymous queues.
|
||||
* @deprecated - use the {@link org.springframework.amqp.core.NamingStrategy}.
|
||||
* @since 1.5.3
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
public interface NamingStrategy extends org.springframework.amqp.core.NamingStrategy {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates names with the form {@code <prefix><base64url>} where
|
||||
* 'prefix' is 'spring.gen-' by default
|
||||
* (e.g. spring.gen-eIwaZAYgQv6LvwaDCfVTNQ);
|
||||
* the 'base64url' String is generated from a UUID. The base64 alphabet
|
||||
* is the "URL and Filename Safe Alphabet"; see RFC-4648. Trailing padding
|
||||
* characters (@code =) are removed.
|
||||
* @deprecated - use the {@link org.springframework.amqp.core.Base64UrlNamingStrategy}.
|
||||
* @since 1.5.3
|
||||
*/
|
||||
@Deprecated
|
||||
public static class Base64UrlNamingStrategy implements NamingStrategy {
|
||||
|
||||
/**
|
||||
* The default instance - using {@code spring.gen-} as the prefix.
|
||||
*/
|
||||
public static final Base64UrlNamingStrategy DEFAULT = new Base64UrlNamingStrategy();
|
||||
|
||||
private final String prefix;
|
||||
|
||||
/**
|
||||
* Construct an instance using the default prefix {@code spring.gen-}.
|
||||
*/
|
||||
public Base64UrlNamingStrategy() {
|
||||
this("spring.gen-");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance using the supplied prefix.
|
||||
* @param prefix The prefix.
|
||||
*/
|
||||
public Base64UrlNamingStrategy(String prefix) {
|
||||
Assert.notNull(prefix, "'prefix' cannot be null; use an empty String ");
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateName() {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
ByteBuffer bb = ByteBuffer.wrap(new byte[16]); // NOSONAR - Magic # deprecated anyway
|
||||
bb.putLong(uuid.getMostSignificantBits())
|
||||
.putLong(uuid.getLeastSignificantBits());
|
||||
// Convert to base64 and remove trailing =
|
||||
return this.prefix + Base64Utils.encodeToUrlSafeString(bb.array())
|
||||
.replaceAll("=", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates names using {@link UUID#randomUUID()}.
|
||||
* (e.g. "f20c818a-006b-4416-bf91-643590fedb0e").
|
||||
* @author Gary Russell
|
||||
* @deprecated - use the {@link org.springframework.amqp.core.UUIDNamingStrategy}.
|
||||
* @since 2.0
|
||||
*/
|
||||
@Deprecated
|
||||
public static class UUIDNamingStrategy implements NamingStrategy {
|
||||
|
||||
/**
|
||||
* The default instance.
|
||||
*/
|
||||
public static final UUIDNamingStrategy DEFAULT = new UUIDNamingStrategy();
|
||||
|
||||
@Override
|
||||
public String generateName() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public abstract class AbstractRabbitListenerContainerFactory<C extends AbstractM
|
||||
|
||||
/**
|
||||
* @param messageConverter the message converter to use
|
||||
* @see AbstractMessageListenerContainer#setMessageConverter(MessageConverter)
|
||||
* @see RabbitListenerEndpoint#setMessageConverter(MessageConverter)
|
||||
*/
|
||||
public void setMessageConverter(MessageConverter messageConverter) {
|
||||
this.messageConverter = messageConverter;
|
||||
@@ -344,7 +344,6 @@ public abstract class AbstractRabbitListenerContainerFactory<C extends AbstractM
|
||||
this.containerConfigurer = configurer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public C createListenerContainer(RabbitListenerEndpoint endpoint) {
|
||||
C instance = createContainerInstance();
|
||||
@@ -354,12 +353,6 @@ public abstract class AbstractRabbitListenerContainerFactory<C extends AbstractM
|
||||
if (this.messageConverter != null) {
|
||||
if (endpoint != null) {
|
||||
endpoint.setMessageConverter(this.messageConverter);
|
||||
if (endpoint.getMessageConverter() == null) {
|
||||
instance.setMessageConverter(this.messageConverter);
|
||||
}
|
||||
}
|
||||
else {
|
||||
instance.setMessageConverter(this.messageConverter);
|
||||
}
|
||||
}
|
||||
javaUtils
|
||||
|
||||
@@ -221,25 +221,6 @@ public class ListenerContainerFactoryBean extends AbstractFactoryBean<AbstractMe
|
||||
this.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unlikely this FB is used for a RabbitListener (it's only used by the
|
||||
* XML parser and this property is never set). We could probably just
|
||||
* remove this, but deprecating, just in case.
|
||||
*/
|
||||
/**
|
||||
* Set the {@link MessageConverter} strategy for converting AMQP Messages.
|
||||
* @param messageConverter the message converter to use
|
||||
* @deprecated - this converter is not used by the container; it was only
|
||||
* used to configure the converter for a {@code @RabbitListener} adapter.
|
||||
* That is now handled differently. If you are manually creating a listener
|
||||
* container, the converter must be configured in a listener adapter (if
|
||||
* present).
|
||||
*/
|
||||
@Deprecated
|
||||
public void setMessageConverter(MessageConverter messageConverter) {
|
||||
this.messageConverter = messageConverter;
|
||||
}
|
||||
|
||||
public void setDeBatchingEnabled(boolean deBatchingEnabled) {
|
||||
this.deBatchingEnabled = deBatchingEnabled;
|
||||
}
|
||||
@@ -421,7 +402,6 @@ public class ListenerContainerFactoryBean extends AbstractFactoryBean<AbstractMe
|
||||
.acceptIfNotNull(this.exposeListenerChannel, container::setExposeListenerChannel)
|
||||
.acceptIfNotNull(this.messageListener, container::setMessageListener)
|
||||
.acceptIfNotNull(this.errorHandler, container::setErrorHandler)
|
||||
.acceptIfNotNull(this.messageConverter, container::setMessageConverter)
|
||||
.acceptIfNotNull(this.deBatchingEnabled, container::setDeBatchingEnabled)
|
||||
.acceptIfNotNull(this.adviceChain, container::setAdviceChain)
|
||||
.acceptIfNotNull(this.afterReceivePostProcessors, container::setAfterReceivePostProcessors)
|
||||
|
||||
@@ -16,28 +16,21 @@
|
||||
|
||||
package org.springframework.amqp.rabbit.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.springframework.amqp.rabbit.support.ExpressionFactoryBean;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.BeanDefinitionHolder;
|
||||
import org.springframework.beans.factory.config.BeanReference;
|
||||
import org.springframework.beans.factory.config.RuntimeBeanReference;
|
||||
import org.springframework.beans.factory.config.TypedStringValue;
|
||||
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
|
||||
import org.springframework.beans.factory.support.ManagedList;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.core.Conventions;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.util.xml.DomUtils;
|
||||
|
||||
/**
|
||||
* Shared utility methods for namespace parsers.
|
||||
@@ -245,31 +238,6 @@ public abstract class NamespaceUtils {
|
||||
return elementId;
|
||||
}
|
||||
|
||||
@Deprecated // Since 2.1. Not used
|
||||
public static BeanComponentDefinition parseInnerBeanDefinition(Element element, ParserContext parserContext) {
|
||||
// parses out inner bean definition for concrete implementation if defined
|
||||
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "bean");
|
||||
BeanComponentDefinition innerComponentDefinition = null;
|
||||
if (childElements != null && childElements.size() == 1) {
|
||||
Element beanElement = childElements.get(0);
|
||||
BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
|
||||
BeanDefinitionHolder bdHolder = delegate.parseBeanDefinitionElement(beanElement);
|
||||
bdHolder = delegate.decorateBeanDefinitionIfRequired(beanElement, bdHolder); // NOSONAR not used
|
||||
BeanDefinition inDef = bdHolder.getBeanDefinition();
|
||||
String beanName = BeanDefinitionReaderUtils.generateBeanName(inDef, parserContext.getRegistry());
|
||||
innerComponentDefinition = new BeanComponentDefinition(inDef, beanName);
|
||||
parserContext.registerBeanComponent(innerComponentDefinition);
|
||||
}
|
||||
|
||||
String ref = element.getAttribute(REF_ATTRIBUTE);
|
||||
Assert.isTrue(!StringUtils.hasText(ref) || innerComponentDefinition == null, //NOSONAR
|
||||
"Ambiguous definition. Inner bean "
|
||||
+ (innerComponentDefinition == null ? innerComponentDefinition : innerComponentDefinition
|
||||
.getBeanDefinition().getBeanClassName()) + " declaration and \"ref\" " + ref
|
||||
+ " are not allowed together.");
|
||||
return innerComponentDefinition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses 'auto-declare' and 'declared-by' attributes.
|
||||
*
|
||||
|
||||
@@ -107,7 +107,7 @@ class TemplateParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
|
||||
NamespaceUtils.setValueIfAttributeDefined(builder, element, CHANNEL_TRANSACTED_ATTRIBUTE);
|
||||
NamespaceUtils.setValueIfAttributeDefined(builder, element, QUEUE_ATTRIBUTE);
|
||||
NamespaceUtils.setValueIfAttributeDefined(builder, element, QUEUE_ATTRIBUTE, "defaultReceiveQueue");
|
||||
NamespaceUtils.setValueIfAttributeDefined(builder, element, EXCHANGE_ATTRIBUTE);
|
||||
NamespaceUtils.setValueIfAttributeDefined(builder, element, ROUTING_KEY_ATTRIBUTE);
|
||||
NamespaceUtils.setValueIfAttributeDefined(builder, element, RECEIVE_TIMEOUT_ATTRIBUTE);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.amqp.rabbit.connection;
|
||||
|
||||
/**
|
||||
* Connection factories implementing this interface return a connection that
|
||||
* provides {@code PublisherCallbackChannel} channel instances when confirms
|
||||
* or returns are enabled.
|
||||
* @deprecated in favor of default methods on ConnectionFactory.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @since 1.5
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public interface PublisherCallbackChannelConnectionFactory {
|
||||
|
||||
/**
|
||||
* @return true if publisher confirms are enabled.
|
||||
*/
|
||||
boolean isPublisherConfirms();
|
||||
|
||||
/**
|
||||
* @return true if publisher returns are enabled.
|
||||
*/
|
||||
boolean isPublisherReturns();
|
||||
|
||||
}
|
||||
@@ -113,16 +113,10 @@ public class PublisherCallbackChannelImpl
|
||||
|
||||
/**
|
||||
* Create a {@link PublisherCallbackChannelImpl} instance based on the provided
|
||||
* delegate.
|
||||
* @param delegate the {@link Channel} to delegate.
|
||||
* @deprecated since 2.2.1 in favor of
|
||||
* {@link #PublisherCallbackChannelImpl(Channel, ExecutorService)}
|
||||
* delegate and executor.
|
||||
* @param delegate the delegate channel.
|
||||
* @param executor the exceutor.
|
||||
*/
|
||||
@Deprecated
|
||||
public PublisherCallbackChannelImpl(Channel delegate) {
|
||||
this(delegate, null); // NOSONAR = deprecated ctor
|
||||
}
|
||||
|
||||
public PublisherCallbackChannelImpl(Channel delegate, ExecutorService executor) {
|
||||
Assert.notNull(executor, "'executor' must not be null");
|
||||
this.delegate = delegate;
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.springframework.amqp.AmqpIOException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.support.ResourceHolderSupport;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
@@ -83,11 +82,6 @@ public class RabbitResourceHolder extends ResourceHolderSupport {
|
||||
this.releaseAfterCompletion = releaseAfterCompletion;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public final boolean isFrozen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the resources should be released after transaction completion.
|
||||
* Default true. Listener containers set to false because the listener continues
|
||||
@@ -143,18 +137,6 @@ public class RabbitResourceHolder extends ResourceHolderSupport {
|
||||
return (!this.connections.isEmpty() ? this.connections.get(0) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a single connection of this type.
|
||||
* @param connectionType the type.
|
||||
* @return the connection or null.
|
||||
* @deprecated Not used.
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
public Connection getConnection(Class<? extends Connection> connectionType) {
|
||||
return CollectionUtils.findValueOfType(this.connections, connectionType);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Channel getChannel() {
|
||||
return (!this.channels.isEmpty() ? this.channels.get(0) : null);
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.amqp.rabbit.core;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -137,8 +136,6 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Applicat
|
||||
|
||||
private ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
private boolean declareCollections = false;
|
||||
|
||||
private TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
|
||||
|
||||
private volatile boolean running = false;
|
||||
@@ -188,20 +185,6 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Applicat
|
||||
this.ignoreDeclarationExceptions = ignoreDeclarationExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to false to disable declaring collections of {@link Declarable}.
|
||||
* Since the admin has to iterate over all Collection beans, this may
|
||||
* cause undesirable side-effects in some cases. Default true.
|
||||
* @param declareCollections set to false to prevent declarations of collections.
|
||||
* @since 1.7.7
|
||||
* @deprecated - users should use {@link Declarables} beans instead of collections of
|
||||
* {@link Declarable}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDeclareCollections(boolean declareCollections) {
|
||||
this.declareCollections = declareCollections;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the last {@link DeclarationExceptionEvent} that was detected in this admin.
|
||||
*
|
||||
@@ -570,7 +553,6 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Applicat
|
||||
Collection<Binding> contextBindings = new LinkedList<Binding>(
|
||||
this.applicationContext.getBeansOfType(Binding.class).values());
|
||||
|
||||
processLegacyCollections(contextExchanges, contextQueues, contextBindings);
|
||||
processDeclarables(contextExchanges, contextQueues, contextBindings);
|
||||
|
||||
final Collection<Exchange> exchanges = filterDeclarables(contextExchanges);
|
||||
@@ -612,37 +594,6 @@ public class RabbitAdmin implements AmqpAdmin, ApplicationContextAware, Applicat
|
||||
|
||||
}
|
||||
|
||||
// TODO: remove in 3.0
|
||||
private void processLegacyCollections(Collection<Exchange> contextExchanges, // NOSONAR complexity
|
||||
Collection<Queue> contextQueues, Collection<Binding> contextBindings) {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
Collection<Collection> collections = this.declareCollections
|
||||
? this.applicationContext.getBeansOfType(Collection.class, false, false).values()
|
||||
: Collections.emptyList();
|
||||
boolean shouldWarn = false;
|
||||
for (Collection<?> collection : collections) {
|
||||
if (collection.size() > 0 && collection.iterator().next() instanceof Declarable) {
|
||||
shouldWarn = true;
|
||||
for (Object declarable : collection) {
|
||||
if (declarable instanceof Exchange) {
|
||||
contextExchanges.add((Exchange) declarable);
|
||||
}
|
||||
else if (declarable instanceof Queue) {
|
||||
contextQueues.add((Queue) declarable);
|
||||
}
|
||||
else if (declarable instanceof Binding) {
|
||||
contextBindings.add((Binding) declarable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shouldWarn && this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("Beans of type Collection<Declarable> are discouraged, and deprecated, "
|
||||
+ "use Declarables beans instead");
|
||||
}
|
||||
}
|
||||
|
||||
private void processDeclarables(Collection<Exchange> contextExchanges, Collection<Queue> contextQueues,
|
||||
Collection<Binding> contextBindings) {
|
||||
Collection<Declarables> declarables = this.applicationContext.getBeansOfType(Declarables.class, false, true)
|
||||
|
||||
@@ -1,295 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.amqp.rabbit.core;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.amqp.AmqpException;
|
||||
import org.springframework.amqp.core.AbstractExchange;
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.Binding.DestinationType;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Exchange;
|
||||
import org.springframework.amqp.core.FanoutExchange;
|
||||
import org.springframework.amqp.core.HeadersExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.core.TopicExchange;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import com.rabbitmq.http.client.Client;
|
||||
import com.rabbitmq.http.client.domain.BindingInfo;
|
||||
import com.rabbitmq.http.client.domain.ExchangeInfo;
|
||||
import com.rabbitmq.http.client.domain.QueueInfo;
|
||||
|
||||
/**
|
||||
* A convenience wrapper for the RabbitMQ {@link Client} providing convenient access to
|
||||
* the REST methods using the familiar Spring AMQP domain objects for {@link Queue},
|
||||
* {@link Exchange} and {@link Binding}. For more complete access, including access to
|
||||
* properties not available in the Spring AMQP domain classes, use the {@link Client}
|
||||
* directly.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 1.5
|
||||
*
|
||||
* @deprecated since 2.1 in favor of direct {@link Client} usage.
|
||||
*/
|
||||
@Deprecated
|
||||
public class RabbitManagementTemplate implements org.springframework.amqp.core.AmqpManagementOperations {
|
||||
|
||||
private static final String DEFAULT_VHOST = "/";
|
||||
|
||||
private final Client rabbitClient;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a template using uri "localhost:15672/api/" and user guest/guest.
|
||||
*/
|
||||
public RabbitManagementTemplate() {
|
||||
this("http://localhost:15672/api/", "guest", "guest");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a template using the supplied client.
|
||||
* @param rabbitClient the client.
|
||||
*/
|
||||
public RabbitManagementTemplate(Client rabbitClient) {
|
||||
this.rabbitClient = rabbitClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a template using the supplied uri.
|
||||
* @param uri the uri - must include user info, e.g.
|
||||
* "http://guest:guest@localhost:15672/api/".
|
||||
* @since 2.0
|
||||
*/
|
||||
public RabbitManagementTemplate(String uri) {
|
||||
try {
|
||||
this.rabbitClient = new Client(uri);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new AmqpException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a template using the supplied uri.
|
||||
* @param uri the uri.
|
||||
* @param username the user.
|
||||
* @param password the password.
|
||||
*/
|
||||
public RabbitManagementTemplate(String uri, String username, String password) {
|
||||
try {
|
||||
this.rabbitClient = new Client(uri, username, password);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new AmqpException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rabbitClient
|
||||
*/
|
||||
public Client getClient() {
|
||||
return this.rabbitClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExchange(Exchange exchange) {
|
||||
addExchange(DEFAULT_VHOST, exchange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExchange(String vhost, Exchange exchange) {
|
||||
ExchangeInfo info = new ExchangeInfo();
|
||||
info.setArguments(exchange.getArguments());
|
||||
info.setAutoDelete(exchange.isAutoDelete());
|
||||
info.setDurable(exchange.isDurable());
|
||||
info.setType(exchange.getType());
|
||||
this.rabbitClient.declareExchange(vhost, exchange.getName(), info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeQueue(Queue queue) {
|
||||
this.rabbitClient.purgeQueue(DEFAULT_VHOST, queue.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeQueue(String vhost, Queue queue) {
|
||||
this.rabbitClient.purgeQueue(vhost, queue.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQueue(Queue queue) {
|
||||
this.rabbitClient.deleteQueue(DEFAULT_VHOST, queue.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteQueue(String vhost, Queue queue) {
|
||||
this.rabbitClient.deleteQueue(vhost, queue.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue getQueue(String name) {
|
||||
return getQueue(DEFAULT_VHOST, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Queue getQueue(String vhost, String name) {
|
||||
return convert(this.rabbitClient.getQueue(vhost, name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Queue> getQueues() {
|
||||
return convertQueueList(this.rabbitClient.getQueues());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Queue> getQueues(String vhost) {
|
||||
return convertQueueList(this.rabbitClient.getQueues(vhost));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQueue(Queue queue) {
|
||||
addQueue(DEFAULT_VHOST, queue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQueue(String vhost, Queue queue) {
|
||||
QueueInfo info = new QueueInfo();
|
||||
info.setArguments(queue.getArguments());
|
||||
info.setAutoDelete(queue.isAutoDelete());
|
||||
info.setDurable(queue.isDurable());
|
||||
info.setExclusive(queue.isExclusive());
|
||||
this.rabbitClient.declareQueue(vhost, queue.getName(), info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteExchange(Exchange exchange) {
|
||||
deleteExchange(DEFAULT_VHOST, exchange);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteExchange(String vhost, Exchange exchange) {
|
||||
this.rabbitClient.deleteExchange(vhost, exchange.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Exchange getExchange(String name) {
|
||||
return getExchange(DEFAULT_VHOST, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Exchange getExchange(String vhost, String name) {
|
||||
return convert(this.rabbitClient.getExchange(vhost, name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Exchange> getExchanges() {
|
||||
return convertExchangeList(this.rabbitClient.getExchanges());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Exchange> getExchanges(String vhost) {
|
||||
return convertExchangeList(this.rabbitClient.getExchanges(vhost));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Binding> getBindings() {
|
||||
return convertBindingList(this.rabbitClient.getBindings());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Binding> getBindings(String vhost) {
|
||||
return convertBindingList(this.rabbitClient.getBindings(vhost));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Binding> getBindingsForExchange(String vhost, String exchange) {
|
||||
return convertBindingList(this.rabbitClient.getBindingsBySource(vhost, exchange));
|
||||
}
|
||||
|
||||
private List<Queue> convertQueueList(List<QueueInfo> queues) {
|
||||
return queues.stream()
|
||||
.map(this::convert)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Queue convert(@Nullable QueueInfo qi) {
|
||||
if (qi == null) {
|
||||
return null;
|
||||
}
|
||||
return new Queue(qi.getName(), qi.isDurable(), qi.isExclusive(), qi.isAutoDelete(),
|
||||
qi.getArguments());
|
||||
}
|
||||
|
||||
private List<Exchange> convertExchangeList(List<ExchangeInfo> exchanges) {
|
||||
return exchanges.stream()
|
||||
.map(this::convert)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Exchange convert(@Nullable ExchangeInfo ei) {
|
||||
if (ei == null) {
|
||||
return null;
|
||||
}
|
||||
boolean delayed = false;
|
||||
if (ei.getType().equals("x-delayed-message")) {
|
||||
ei.setType((String) ei.getArguments().get("x-delayed-type"));
|
||||
delayed = true;
|
||||
}
|
||||
AbstractExchange exchange;
|
||||
if (ei.getType().equals("direct")) {
|
||||
exchange = new DirectExchange(ei.getName(), ei.isDurable(), ei.isAutoDelete(), ei.getArguments());
|
||||
}
|
||||
else if (ei.getType().equals("fanout")) {
|
||||
exchange = new FanoutExchange(ei.getName(), ei.isDurable(), ei.isAutoDelete(), ei.getArguments());
|
||||
}
|
||||
else if (ei.getType().equals("headers")) {
|
||||
exchange = new HeadersExchange(ei.getName(), ei.isDurable(), ei.isAutoDelete(), ei.getArguments());
|
||||
}
|
||||
else if (ei.getType().equals("topic")) {
|
||||
exchange = new TopicExchange(ei.getName(), ei.isDurable(), ei.isAutoDelete(), ei.getArguments());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
exchange.setDelayed(delayed);
|
||||
exchange.setInternal(ei.isInternal());
|
||||
return exchange;
|
||||
}
|
||||
|
||||
private List<Binding> convertBindingList(List<BindingInfo> bindings) {
|
||||
return bindings.stream()
|
||||
.map(this::convert)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Binding convert(@Nullable BindingInfo bi) {
|
||||
if (bi == null) {
|
||||
return null;
|
||||
}
|
||||
return new Binding(bi.getDestination(), DestinationType.valueOf(bi.getDestinationType().toUpperCase()),
|
||||
bi.getSource(), bi.getRoutingKey(), bi.getArguments());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -323,16 +323,6 @@ public class RabbitTemplate extends RabbitAccessor // NOSONAR type line count
|
||||
return this.routingKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the default queue to receive messages from when none is specified explicitly.
|
||||
* @param queue the default queue name to use for receive
|
||||
* @deprecated in favor of {@link #setDefaultReceiveQueue(String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setQueue(String queue) {
|
||||
this.defaultReceiveQueue = queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the default queue to receive messages from when none is specified explicitly.
|
||||
* @param queue the default queue name to use for receive
|
||||
|
||||
@@ -398,24 +398,6 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor
|
||||
this.exposeListenerChannel = exposeListenerChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message listener implementation to register. This can be either a Spring
|
||||
* {@link MessageListener} object or a Spring {@link ChannelAwareMessageListener}
|
||||
* object.
|
||||
*
|
||||
* @param messageListener The listener.
|
||||
* @throws IllegalArgumentException if the supplied listener is not a
|
||||
* {@link MessageListener} or a {@link ChannelAwareMessageListener}
|
||||
* @deprecated use {@link #setMessageListener(MessageListener)}.
|
||||
* @see MessageListener
|
||||
* @see ChannelAwareMessageListener
|
||||
*/
|
||||
@Deprecated
|
||||
public void setMessageListener(Object messageListener) {
|
||||
checkMessageListener(messageListener);
|
||||
setMessageListener((MessageListener) messageListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link MessageListener}.
|
||||
* @param messageListener the listener.
|
||||
@@ -425,28 +407,16 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor
|
||||
this.messageListener = messageListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link ChannelAwareMessageListener}.
|
||||
* @param messageListener the listener.
|
||||
* @since 2.0
|
||||
* @deprecated use {@link #setMessageListener(MessageListener)} since
|
||||
* {@link ChannelAwareMessageListener} now inherits {@link MessageListener}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setChannelAwareMessageListener(ChannelAwareMessageListener messageListener) {
|
||||
this.messageListener = messageListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the given message listener, throwing an exception if it does not correspond to a supported listener type.
|
||||
* <p>
|
||||
* Only a Spring {@link MessageListener} object will be accepted.
|
||||
* @param messageListener the message listener object to check
|
||||
* @param listener the message listener object to check
|
||||
* @throws IllegalArgumentException if the supplied listener is not a MessageListener
|
||||
* @see MessageListener
|
||||
*/
|
||||
protected void checkMessageListener(Object messageListener) {
|
||||
if (!(messageListener instanceof MessageListener)) {
|
||||
protected void checkMessageListener(Object listener) {
|
||||
if (!(listener instanceof MessageListener)) {
|
||||
throw new IllegalArgumentException("Message listener needs to be of type ["
|
||||
+ MessageListener.class.getName() + "] or [" + ChannelAwareMessageListener.class.getName() + "]");
|
||||
}
|
||||
@@ -469,28 +439,6 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor
|
||||
this.errorHandler = errorHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link MessageConverter} strategy for converting AMQP Messages.
|
||||
* @param messageConverter the message converter to use
|
||||
* @deprecated - this converter is not used by the container; it was only
|
||||
* used to configure the converter for a {@code @RabbitListener} adapter.
|
||||
* That is now handled differently. If you are manually creating a listener
|
||||
* container, the converter must be configured in a listener adapter (if
|
||||
* present).
|
||||
*/
|
||||
@Deprecated
|
||||
public void setMessageConverter(MessageConverter messageConverter) {
|
||||
this.logger.warn("It is preferred to configure the message converter via the endpoint. "
|
||||
+ "See RabbitListenerEndpoint.setMessageConverter");
|
||||
this.messageConverter = messageConverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageConverter getMessageConverter() {
|
||||
return this.messageConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not the container should de-batch batched
|
||||
* messages (true) or call the listener with the batch (false). Default: true.
|
||||
@@ -938,17 +886,6 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor
|
||||
return this.messagePropertiesConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the admin.
|
||||
* @return the admin.
|
||||
* @deprecated in favor of {@link #getAmqpAdmin()}
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable
|
||||
protected AmqpAdmin getRabbitAdmin() {
|
||||
return getAmqpAdmin();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected AmqpAdmin getAmqpAdmin() {
|
||||
return this.amqpAdmin;
|
||||
@@ -967,20 +904,6 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor
|
||||
this.amqpAdmin = amqpAdmin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the {@link AmqpAdmin}, used to declare any auto-delete queues, bindings
|
||||
* etc when the container is started. Only needed if those queues use conditional
|
||||
* declaration (have a 'declared-by' attribute). If not specified, an internal
|
||||
* admin will be used which will attempt to declare all elements not having a
|
||||
* 'declared-by' attribute.
|
||||
* @param amqpAdmin The admin.
|
||||
* @deprecated in favor of {@link #setAmqpAdmin(AmqpAdmin)}
|
||||
*/
|
||||
@Deprecated
|
||||
public final void setRabbitAdmin(AmqpAdmin amqpAdmin) {
|
||||
setAmqpAdmin(amqpAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* If all of the configured queue(s) are not available on the broker, this setting
|
||||
* determines whether the condition is fatal. When true, and
|
||||
|
||||
@@ -82,21 +82,6 @@ public class DirectReplyToMessageListenerContainer extends DirectMessageListener
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setMessageListener(Object messageListener) {
|
||||
throw new UnsupportedOperationException(
|
||||
"'messageListener' must be a 'MessageListener' or 'ChannelAwareMessageListener'");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void setChannelAwareMessageListener(ChannelAwareMessageListener messageListener) {
|
||||
setMessageListener(messageListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageListener(MessageListener messageListener) {
|
||||
if (messageListener instanceof ChannelAwareMessageListener) {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.amqp.rabbit.listener;
|
||||
|
||||
import org.springframework.amqp.core.MessageListener;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.context.SmartLifecycle;
|
||||
|
||||
/**
|
||||
@@ -37,18 +36,6 @@ public interface MessageListenerContainer extends SmartLifecycle {
|
||||
*/
|
||||
void setupMessageListener(MessageListener messageListener);
|
||||
|
||||
/**
|
||||
* @return the {@link MessageConverter} that can be used to
|
||||
* convert {@link org.springframework.amqp.core.Message}, if any.
|
||||
* @deprecated - this converter is not used by the container; it was only
|
||||
* used to configure the converter for a {@code @RabbitListener} adapter.
|
||||
* That is now handled differently. If you are manually creating a listener
|
||||
* container, the converter must be configured in a listener adapter (if
|
||||
* present).
|
||||
*/
|
||||
@Deprecated
|
||||
MessageConverter getMessageConverter();
|
||||
|
||||
/**
|
||||
* Do not check for missing or mismatched queues during startup. Used for lazily
|
||||
* loaded message listener containers to avoid a deadlock when starting such
|
||||
|
||||
@@ -125,10 +125,6 @@ public class MethodRabbitListenerEndpoint extends AbstractRabbitListenerEndpoint
|
||||
messageListener.setResponseAddress(replyToAddress);
|
||||
}
|
||||
MessageConverter messageConverter = getMessageConverter();
|
||||
if (messageConverter == null) {
|
||||
// fall back to the legacy converter holder in the container
|
||||
messageConverter = container.getMessageConverter();
|
||||
}
|
||||
if (messageConverter != null) {
|
||||
messageListener.setMessageConverter(messageConverter);
|
||||
}
|
||||
|
||||
@@ -194,17 +194,6 @@ public abstract class AbstractAdaptableMessageListener implements ChannelAwareMe
|
||||
this.messageConverter = messageConverter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a post processor to process the reply immediately before
|
||||
* {@code Channel#basicPublish()}. Often used to compress the data.
|
||||
* @param replyPostProcessor the reply post processor.
|
||||
* @deprecated in favor of {@link #setBeforeSendReplyPostProcessors(MessagePostProcessor...)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setReplyPostProcessor(MessagePostProcessor replyPostProcessor) {
|
||||
setBeforeSendReplyPostProcessors(replyPostProcessor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set post processors that will be applied before sending replies.
|
||||
* @param beforeSendReplyPostProcessors the post processors.
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.amqp.rabbit.config;
|
||||
import org.springframework.amqp.core.MessageListener;
|
||||
import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
|
||||
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpoint;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@@ -100,12 +99,6 @@ public class MessageListenerTestContainer
|
||||
public void setupMessageListener(MessageListener messageListener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public MessageConverter getMessageConverter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
initializationInvoked = true;
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
<rabbit:queue id="customAnon" naming-strategy="customNamer" />
|
||||
|
||||
<bean id="uuidNamer" class="org.springframework.amqp.core.AnonymousQueue.UUIDNamingStrategy" />
|
||||
<bean id="uuidNamer" class="org.springframework.amqp.core.UUIDNamingStrategy" />
|
||||
|
||||
<bean id="customNamer" class="org.springframework.amqp.core.AnonymousQueue.Base64UrlNamingStrategy">
|
||||
<bean id="customNamer" class="org.springframework.amqp.core.Base64UrlNamingStrategy">
|
||||
<constructor-arg value="custom.gen-" />
|
||||
</bean>
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
<rabbit:queue id="customAnon" naming-strategy="customNamer" />
|
||||
|
||||
<bean id="uuidNamer" class="org.springframework.amqp.core.AnonymousQueue.UUIDNamingStrategy" />
|
||||
<bean id="uuidNamer" class="org.springframework.amqp.core.UUIDNamingStrategy" />
|
||||
|
||||
<bean id="customNamer" class="org.springframework.amqp.core.AnonymousQueue.Base64UrlNamingStrategy">
|
||||
<bean id="customNamer" class="org.springframework.amqp.core.Base64UrlNamingStrategy">
|
||||
<constructor-arg value="custom.gen-" />
|
||||
</bean>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user