Author: davsclaus Date: Thu May 14 08:42:28 2009 New Revision: 774687 URL: http://svn.apache.org/viewvc?rev=774687&view=rev Log: CAMEL-1614:Fixed bug if JMSReplyTo was in headers but null. To avoid WARN logs for InOnly messages with no JMSReplyTo anyway.
Modified: camel/branches/camel-1.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java Modified: camel/branches/camel-1.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java?rev=774687&r1=774686&r2=774687&view=diff ============================================================================== --- camel/branches/camel-1.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java (original) +++ camel/branches/camel-1.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java Thu May 14 08:42:28 2009 @@ -224,15 +224,17 @@ exchange.setException(e); } } else { - if (!endpoint.getConfiguration().isPreserveMessageQos() && !endpoint.getConfiguration().isExplicitQosEnabled() - && exchange.getIn().getHeaders().containsKey("JMSReplyTo")) { - // we are routing an existing JmsMessage, origin from another JMS endpoint - // then we need to remove the existing JMSReplyTo, JMSCorrelationID. - // as we are not out capable and thus do not expect a reply, and therefore - // the consumer of this message we send should not return a reply - String to = endpoint.getDestination(); - LOG.warn("Disabling JMSReplyTo as this Exchange is not OUT capable: " + exchange + " with destination: " + to); - exchange.getIn().setHeader("JMSReplyTo", null); + // we must honor these special flags to preverse QoS + if (!endpoint.getConfiguration().isPreserveMessageQos() && !endpoint.getConfiguration().isExplicitQosEnabled()) { + Object replyTo = exchange.getIn().getHeader("JMSReplyTo"); + if (replyTo != null) { + // we are routing an existing JmsMessage, origin from another JMS endpoint + // then we need to remove the existing JMSReplyTo + // as we are not out capable and thus do not expect a reply, and therefore + // the consumer of this message we send should not return a reply + LOG.warn("Disabling JMSReplyTo as this Exchange is not OUT capable with JMSReplyTo: " + replyTo + " for Exchange: " + exchange); + exchange.getIn().setHeader("JMSReplyTo", null); + } } getInOnlyTemplate().send(endpoint.getDestination(), new MessageCreator() {