You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/10/04 06:51:44 UTC
[camel] 01/03: CAMEL-14033: Fixed NPE in camel-sjms when doing
request/reply and recieving a message that cannot be correlated. Using
similar logging as camel-jms does.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 000938a9e22a4b214db8a6b79fc5564e060442b1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Oct 4 08:48:18 2019 +0200
CAMEL-14033: Fixed NPE in camel-sjms when doing request/reply and recieving a message that cannot be correlated. Using similar logging as camel-jms does.
---
.../apache/camel/component/sjms/producer/InOutProducer.java | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
index 141583b..5d89d2b 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
@@ -104,8 +104,17 @@ public class InOutProducer extends SjmsProducer {
log.debug("Message Received in the Consumer Pool");
log.debug(" Message : {}", message);
try {
- Exchanger<Object> exchanger = EXCHANGERS.get(message.getJMSCorrelationID());
- exchanger.exchange(message, getResponseTimeOut(), TimeUnit.MILLISECONDS);
+ String correlationID = message.getJMSCorrelationID();
+ Exchanger<Object> exchanger = EXCHANGERS.get(correlationID);
+ if (exchanger != null) {
+ exchanger.exchange(message, getResponseTimeOut(), TimeUnit.MILLISECONDS);
+ } else {
+ // we could not correlate the received reply message to a matching request and therefore
+ // we cannot continue routing the unknown message
+ // log a warn and then ignore the message
+ log.warn("Reply received for unknown correlationID [{}] on reply destination [{}]. Current correlation map size: {}. The message will be ignored: {}",
+ new Object[]{correlationID, replyToDestination, EXCHANGERS.size(), message});
+ }
} catch (Exception e) {
log.warn("Unable to exchange message: {}. This exception is ignored.", message, e);
}