diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java
index 553eac05..2d492d84 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactory.java
@@ -728,6 +728,7 @@ public class CachingConnectionFactory extends AbstractConnectionFactory
* return null, if there are no open idle, return the first closed idle so it can
* be reopened.
*/
+ @Nullable
private ChannelCachingConnectionProxy findIdleConnection() {
ChannelCachingConnectionProxy connection = null;
ChannelCachingConnectionProxy lastIdle = this.idleConnections.peekLast();
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleResourceHolder.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleResourceHolder.java
index ea5a999e..678a671f 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleResourceHolder.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/SimpleResourceHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2014-2017 the original author or authors.
+ * Copyright 2014-2018 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.
@@ -78,6 +78,7 @@ public final class SimpleResourceHolder {
* @return a value bound to the current thread (usually the active
* resource object), or null if none
*/
+ @Nullable
public static Object get(Object key) {
Object value = doGet(key);
if (value != null && logger.isTraceEnabled()) {
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitGatewaySupport.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitGatewaySupport.java
index 8adf1188..0b766ac9 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitGatewaySupport.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitGatewaySupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -22,6 +22,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.InitializingBean;
+import org.springframework.lang.Nullable;
/**
* Convenient super class for application classes that need RabbitMQ access.
@@ -72,6 +73,7 @@ public class RabbitGatewaySupport implements InitializingBean {
/**
* @return The Rabbit ConnectionFactory used by the gateway.
*/
+ @Nullable
public final ConnectionFactory getConnectionFactory() {
return (this.rabbitOperations != null ? this.rabbitOperations.getConnectionFactory() : null);
}
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitManagementTemplate.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitManagementTemplate.java
index db3d5cad..40e027f8 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitManagementTemplate.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitManagementTemplate.java
@@ -29,6 +29,7 @@ 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;
@@ -230,7 +231,8 @@ public class RabbitManagementTemplate implements org.springframework.amqp.core.A
.collect(Collectors.toList());
}
- private Queue convert(QueueInfo qi) {
+ @Nullable
+ private Queue convert(@Nullable QueueInfo qi) {
if (qi == null) {
return null;
}
@@ -244,7 +246,8 @@ public class RabbitManagementTemplate implements org.springframework.amqp.core.A
.collect(Collectors.toList());
}
- private Exchange convert(ExchangeInfo ei) {
+ @Nullable
+ private Exchange convert(@Nullable ExchangeInfo ei) {
if (ei == null) {
return null;
}
@@ -280,7 +283,8 @@ public class RabbitManagementTemplate implements org.springframework.amqp.core.A
.collect(Collectors.toList());
}
- private Binding convert(BindingInfo bi) {
+ @Nullable
+ private Binding convert(@Nullable BindingInfo bi) {
if (bi == null) {
return null;
}
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitMessagingTemplate.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitMessagingTemplate.java
index 4624e9a8..048ad795 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitMessagingTemplate.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitMessagingTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2017 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -22,6 +22,7 @@ import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.amqp.support.converter.MessagingMessageConverter;
import org.springframework.beans.factory.InitializingBean;
+import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
import org.springframework.messaging.converter.MessageConversionException;
@@ -126,21 +127,22 @@ public class RabbitMessagingTemplate extends AbstractMessagingTemplate
@Override
public void convertAndSend(String exchange, String routingKey, Object payload,
- Map headers) throws MessagingException {
+ @Nullable Map headers) throws MessagingException {
convertAndSend(exchange, routingKey, payload, headers, null);
}
@Override
public void convertAndSend(String exchange, String routingKey, Object payload,
- MessagePostProcessor postProcessor) throws MessagingException {
+ @Nullable MessagePostProcessor postProcessor) throws MessagingException {
convertAndSend(exchange, routingKey, payload, null, postProcessor);
}
@Override
public void convertAndSend(String exchange, String routingKey, Object payload,
- Map headers, MessagePostProcessor postProcessor) throws MessagingException {
+ @Nullable Map headers, @Nullable MessagePostProcessor postProcessor)
+ throws MessagingException {
Message> message = doConvert(payload, headers, postProcessor);
send(exchange, routingKey, message);
@@ -162,22 +164,23 @@ public class RabbitMessagingTemplate extends AbstractMessagingTemplate
@Override
public T convertSendAndReceive(String exchange, String routingKey, Object request,
- Map headers, Class targetClass) throws MessagingException {
+ @Nullable Map headers, Class targetClass) throws MessagingException {
return convertSendAndReceive(exchange, routingKey, request, headers, targetClass, null);
}
@Override
public T convertSendAndReceive(String exchange, String routingKey, Object request,
- Class targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException {
+ Class targetClass, @Nullable MessagePostProcessor requestPostProcessor) throws MessagingException {
return convertSendAndReceive(exchange, routingKey, request, null, targetClass, requestPostProcessor);
}
@SuppressWarnings("unchecked")
@Override
- public T convertSendAndReceive(String exchange, String routingKey, Object request, Map headers,
- Class targetClass, MessagePostProcessor requestPostProcessor) throws MessagingException {
+ public T convertSendAndReceive(String exchange, String routingKey, Object request,
+ @Nullable Map headers,
+ Class targetClass, @Nullable MessagePostProcessor requestPostProcessor) throws MessagingException {
Message> requestMessage = doConvert(request, headers, requestPostProcessor);
Message> replyMessage = sendAndReceive(exchange, routingKey, requestMessage);
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java
index d7ef5a50..9303c278 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitOperations.java
@@ -23,6 +23,7 @@ import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.lang.Nullable;
/**
* Rabbit specific methods for Amqp functionality.
@@ -68,8 +69,8 @@ public interface RabbitOperations extends AmqpTemplate {
* @return the result of the action method.
* @since 2.1
*/
- T invoke(OperationsCallback action, com.rabbitmq.client.ConfirmCallback acks,
- com.rabbitmq.client.ConfirmCallback nacks);
+ T invoke(OperationsCallback action, @Nullable com.rabbitmq.client.ConfirmCallback acks,
+ @Nullable com.rabbitmq.client.ConfirmCallback nacks);
/**
* Delegate to the underlying dedicated channel to wait for confirms. The connection
@@ -336,7 +337,9 @@ public interface RabbitOperations extends AmqpTemplate {
* @throws AmqpException if there is a problem
*/
default T convertSendAndReceiveAsType(String exchange, String routingKey, Object message,
- CorrelationData correlationData, ParameterizedTypeReference responseType) throws AmqpException {
+ @Nullable CorrelationData correlationData, ParameterizedTypeReference responseType)
+ throws AmqpException {
+
return convertSendAndReceiveAsType(exchange, routingKey, message, null, correlationData, responseType);
}
@@ -399,7 +402,7 @@ public interface RabbitOperations extends AmqpTemplate {
* @throws AmqpException if there is a problem
*/
T convertSendAndReceiveAsType(String exchange, String routingKey, Object message,
- MessagePostProcessor messagePostProcessor, CorrelationData correlationData,
+ @Nullable MessagePostProcessor messagePostProcessor, CorrelationData correlationData,
ParameterizedTypeReference responseType) throws AmqpException;
/**
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java
index 6c4c1e20..31cfa43e 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java
@@ -714,6 +714,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
* @since 1.5
*/
@Override
+ @Nullable
public Collection expectedQueueNames() {
this.isListener = true;
Collection replyQueue = null;
@@ -741,6 +742,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
* @return the collection of correlation data for which confirms have
* not been received or null if no such confirms exist.
*/
+ @Nullable
public Collection getUnconfirmed(long age) {
Set unconfirmed = new HashSet<>();
long cutoffTime = System.currentTimeMillis() - age;
@@ -935,8 +937,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
}
@Override
- public void convertAndSend(String exchange, String routingKey, final Object object, CorrelationData correlationData)
- throws AmqpException {
+ public void convertAndSend(String exchange, String routingKey, final Object object,
+ @Nullable CorrelationData correlationData) throws AmqpException {
+
send(exchange, routingKey, convertMessageIfNecessary(object), correlationData);
}
@@ -973,7 +976,8 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
@Override
public void convertAndSend(String exchange, String routingKey, final Object message,
- final MessagePostProcessor messagePostProcessor, CorrelationData correlationData) throws AmqpException {
+ final MessagePostProcessor messagePostProcessor,
+ @Nullable CorrelationData correlationData) throws AmqpException {
Message messageToSend = convertMessageIfNecessary(message);
messageToSend = messagePostProcessor.postProcessMessage(messageToSend, correlationData);
send(exchange, routingKey, messageToSend, correlationData);
@@ -1159,6 +1163,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
}, obtainTargetConnectionFactory(this.receiveConnectionFactorySelectorExpression, queueName));
}
+ @Nullable
private Message receiveForReply(final String queueName, Channel channel) throws Exception {
boolean channelTransacted = isChannelTransacted();
boolean channelLocallyTransacted = isChannelLocallyTransacted(channel);
@@ -1199,6 +1204,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
return receiveMessage;
}
+ @Nullable
private Delivery consumeDelivery(Channel channel, String queueName, long timeoutMillis) throws Exception {
Delivery delivery = null;
RuntimeException exception = null;
@@ -1326,7 +1332,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
return sendAndReceive(message, null);
}
- public Message sendAndReceive(final Message message, CorrelationData correlationData) throws AmqpException {
+ public Message sendAndReceive(final Message message, @Nullable CorrelationData correlationData)
+ throws AmqpException {
+
return doSendAndReceive(this.exchange, this.routingKey, message, correlationData);
}
@@ -1335,18 +1343,22 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
return sendAndReceive(routingKey, message, null);
}
- public Message sendAndReceive(final String routingKey, final Message message, CorrelationData correlationData) throws AmqpException {
+ public Message sendAndReceive(final String routingKey, final Message message,
+ @Nullable CorrelationData correlationData) throws AmqpException {
+
return doSendAndReceive(this.exchange, routingKey, message, correlationData);
}
@Override
public Message sendAndReceive(final String exchange, final String routingKey, final Message message)
throws AmqpException {
+
return sendAndReceive(exchange, routingKey, message, null);
}
- public Message sendAndReceive(final String exchange, final String routingKey, final Message message, CorrelationData correlationData)
- throws AmqpException {
+ public Message sendAndReceive(final String exchange, final String routingKey, final Message message,
+ @Nullable CorrelationData correlationData) throws AmqpException {
+
return doSendAndReceive(exchange, routingKey, message, correlationData);
}
@@ -1356,7 +1368,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
}
@Override
- public Object convertSendAndReceive(final Object message, CorrelationData correlationData) throws AmqpException {
+ public Object convertSendAndReceive(final Object message, @Nullable CorrelationData correlationData)
+ throws AmqpException {
+
return convertSendAndReceive(this.exchange, this.routingKey, message, null, correlationData);
}
@@ -1366,8 +1380,8 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
}
@Override
- public Object convertSendAndReceive(final String routingKey, final Object message, CorrelationData correlationData)
- throws AmqpException {
+ public Object convertSendAndReceive(final String routingKey, final Object message,
+ @Nullable CorrelationData correlationData) throws AmqpException {
return convertSendAndReceive(this.exchange, routingKey, message, null, correlationData);
}
@@ -1415,7 +1429,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
@Override
public Object convertSendAndReceive(final String exchange, final String routingKey, final Object message,
- final MessagePostProcessor messagePostProcessor, final CorrelationData correlationData) throws AmqpException {
+ @Nullable final MessagePostProcessor messagePostProcessor,
+ @Nullable final CorrelationData correlationData) throws AmqpException {
+
Message replyMessage = convertSendAndReceiveRaw(exchange, routingKey, message, messagePostProcessor,
correlationData);
if (replyMessage == null) {
@@ -1431,8 +1447,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
}
@Override
- public T convertSendAndReceiveAsType(final Object message, CorrelationData correlationData,
+ public T convertSendAndReceiveAsType(final Object message, @Nullable CorrelationData correlationData,
ParameterizedTypeReference responseType) throws AmqpException {
+
return convertSendAndReceiveAsType(this.exchange, this.routingKey, message, null, correlationData,
responseType);
}
@@ -1440,44 +1457,54 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
@Override
public T convertSendAndReceiveAsType(final String routingKey, final Object message,
ParameterizedTypeReference responseType) throws AmqpException {
+
return convertSendAndReceiveAsType(routingKey, message, (CorrelationData) null, responseType);
}
@Override
public T convertSendAndReceiveAsType(final String routingKey, final Object message,
- CorrelationData correlationData, ParameterizedTypeReference responseType) throws AmqpException {
+ @Nullable CorrelationData correlationData, ParameterizedTypeReference responseType)
+ throws AmqpException {
+
return convertSendAndReceiveAsType(this.exchange, routingKey, message, null, correlationData, responseType);
}
@Override
public T convertSendAndReceiveAsType(final String exchange, final String routingKey, final Object message,
ParameterizedTypeReference responseType) throws AmqpException {
+
return convertSendAndReceiveAsType(exchange, routingKey, message, (CorrelationData) null, responseType);
}
@Override
- public T convertSendAndReceiveAsType(final Object message, final MessagePostProcessor messagePostProcessor,
+ public T convertSendAndReceiveAsType(final Object message,
+ @Nullable final MessagePostProcessor messagePostProcessor,
ParameterizedTypeReference responseType) throws AmqpException {
+
return convertSendAndReceiveAsType(message, messagePostProcessor, null, responseType);
}
@Override
- public T convertSendAndReceiveAsType(final Object message, final MessagePostProcessor messagePostProcessor,
- CorrelationData correlationData, ParameterizedTypeReference responseType) throws AmqpException {
+ public T convertSendAndReceiveAsType(final Object message,
+ @Nullable final MessagePostProcessor messagePostProcessor,
+ @Nullable CorrelationData correlationData, ParameterizedTypeReference responseType)
+ throws AmqpException {
+
return convertSendAndReceiveAsType(this.exchange, this.routingKey, message, messagePostProcessor,
correlationData, responseType);
}
@Override
public T convertSendAndReceiveAsType(final String routingKey, final Object message,
- final MessagePostProcessor messagePostProcessor, ParameterizedTypeReference responseType)
- throws AmqpException {
+ @Nullable final MessagePostProcessor messagePostProcessor, ParameterizedTypeReference responseType)
+ throws AmqpException {
+
return convertSendAndReceiveAsType(routingKey, message, messagePostProcessor, null, responseType);
}
@Override
public T convertSendAndReceiveAsType(final String routingKey, final Object message,
- final MessagePostProcessor messagePostProcessor, CorrelationData correlationData,
+ @Nullable final MessagePostProcessor messagePostProcessor, @Nullable CorrelationData correlationData,
ParameterizedTypeReference responseType) throws AmqpException {
return convertSendAndReceiveAsType(this.exchange, routingKey, message, messagePostProcessor, correlationData,
responseType);
@@ -1493,8 +1520,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
@Override
@SuppressWarnings("unchecked")
public T convertSendAndReceiveAsType(final String exchange, final String routingKey, final Object message,
- final MessagePostProcessor messagePostProcessor, final CorrelationData correlationData,
+ @Nullable final MessagePostProcessor messagePostProcessor, @Nullable final CorrelationData correlationData,
ParameterizedTypeReference responseType) throws AmqpException {
+
Message replyMessage = convertSendAndReceiveRaw(exchange, routingKey, message, messagePostProcessor,
correlationData);
if (replyMessage == null) {
@@ -1516,7 +1544,9 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
* @since 1.6.6
*/
protected Message convertSendAndReceiveRaw(final String exchange, final String routingKey, final Object message,
- final MessagePostProcessor messagePostProcessor, final CorrelationData correlationData) {
+ @Nullable final MessagePostProcessor messagePostProcessor,
+ @Nullable final CorrelationData correlationData) {
+
Message requestMessage = convertMessageIfNecessary(message);
if (messagePostProcessor != null) {
requestMessage = messagePostProcessor.postProcessMessage(requestMessage, correlationData);
@@ -1999,7 +2029,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
* @throws Exception If thrown by RabbitMQ API methods
*/
public void doSend(Channel channel, String exchange, String routingKey, Message message,
- boolean mandatory, CorrelationData correlationData) throws Exception {
+ boolean mandatory, @Nullable CorrelationData correlationData) throws Exception {
if (exchange == null) {
// try to send to configured exchange
exchange = this.exchange;
@@ -2045,7 +2075,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
channel.basicPublish(exchange, routingKey, mandatory, convertedMessageProperties, message.getBody());
}
- private void setupConfirm(Channel channel, Message message, CorrelationData correlationData) {
+ private void setupConfirm(Channel channel, Message message, @Nullable CorrelationData correlationData) {
if ((this.publisherConfirms || this.confirmCallback != null) && channel instanceof PublisherCallbackChannel) {
PublisherCallbackChannel publisherCallbackChannel = (PublisherCallbackChannel) channel;
correlationData = this.correlationDataPostProcessor != null
@@ -2359,7 +2389,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
return this.savedCorrelation;
}
- public void setSavedCorrelation(String savedCorrelation) {
+ public void setSavedCorrelation(@Nullable String savedCorrelation) {
this.savedCorrelation = savedCorrelation;
}
@@ -2372,6 +2402,7 @@ public class RabbitTemplate extends RabbitAccessor implements BeanFactoryAware,
}
}
+ @Nullable
public Message get(long timeout, TimeUnit unit) throws InterruptedException {
try {
return this.future.get(timeout, unit);
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/DirectReplyToMessageListenerContainer.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/DirectReplyToMessageListenerContainer.java
index 98e62af4..30349640 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/DirectReplyToMessageListenerContainer.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/DirectReplyToMessageListenerContainer.java
@@ -24,6 +24,7 @@ import org.springframework.amqp.core.Address;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
+import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.rabbitmq.client.Channel;
@@ -201,7 +202,7 @@ public class DirectReplyToMessageListenerContainer extends DirectMessageListener
* @param cancelConsumer true to cancel the consumer.
* @param message a message to be included in the cancel event if cancelConsumer is true.
*/
- public void releaseConsumerFor(ChannelHolder channelHolder, boolean cancelConsumer, String message) {
+ public void releaseConsumerFor(ChannelHolder channelHolder, boolean cancelConsumer, @Nullable String message) {
synchronized (this.consumersMonitor) {
SimpleConsumer consumer = this.inUseConsumerChannels.get(channelHolder.getChannel());
if (consumer != null) {
diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/MessagePropertiesConverter.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/MessagePropertiesConverter.java
index 519c51a3..475fc57b 100644
--- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/MessagePropertiesConverter.java
+++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/MessagePropertiesConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2018 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.
@@ -17,6 +17,7 @@
package org.springframework.amqp.rabbit.support;
import org.springframework.amqp.core.MessageProperties;
+import org.springframework.lang.Nullable;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.Envelope;
@@ -30,7 +31,7 @@ import com.rabbitmq.client.Envelope;
*/
public interface MessagePropertiesConverter {
- MessageProperties toMessageProperties(BasicProperties source, Envelope envelope, String charset);
+ MessageProperties toMessageProperties(BasicProperties source, @Nullable Envelope envelope, String charset);
BasicProperties fromMessageProperties(MessageProperties source, String charset);