camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1358941 - /camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
Date Mon, 09 Jul 2012 07:26:20 GMT
Author: davsclaus
Date: Mon Jul  9 07:26:20 2012
New Revision: 1358941

URL: http://svn.apache.org/viewvc?rev=1358941&view=rev
Log:
Polished camel-jms producer to have better debug/trace logging.

Modified:
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java?rev=1358941&r1=1358940&r2=1358941&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
Mon Jul  9 07:26:20 2012
@@ -181,20 +181,23 @@ public class JmsProducer extends Default
 
         MessageCreator messageCreator = new MessageCreator() {
             public Message createMessage(Session session) throws JMSException {
-                Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session,
null);
+                Message answer = endpoint.getBinding().makeJmsMessage(exchange, in, session,
null);
 
                 // get the reply to destination to be used from the reply manager
                 Destination replyTo = replyManager.getReplyTo();
                 if (replyTo == null) {
                     throw new RuntimeExchangeException("Failed to resolve replyTo destination",
exchange);
                 }
-                JmsMessageHelper.setJMSReplyTo(message, replyTo);
-                replyManager.setReplyToSelectorHeader(in, message);
+                LOG.debug("Using JMSReplyTo destination: {}", replyTo);
+                JmsMessageHelper.setJMSReplyTo(answer, replyTo);
+                replyManager.setReplyToSelectorHeader(in, answer);
 
-                String correlationId = determineCorrelationId(message, provisionalCorrelationId);
+                String correlationId = determineCorrelationId(answer, provisionalCorrelationId);
                 replyManager.registerReply(replyManager, exchange, callback, originalCorrelationId,
correlationId, endpoint.getRequestTimeout());
+                LOG.debug("Using JMSCorrelationID: {}", correlationId);
 
-                return message;
+                LOG.trace("Created javax.jms.Message: {}", answer);
+                return answer;
             }
         };
 
@@ -301,13 +304,19 @@ public class JmsProducer extends Default
                 // and if needed create the destination using the session if needed to
                 if (jmsReplyTo != null && jmsReplyTo instanceof String) {
                     // must normalize the destination name
-                    String replyTo = normalizeDestinationName((String) jmsReplyTo);
+                    String before = (String) jmsReplyTo;
+                    String replyTo = normalizeDestinationName(before);
                     // we need to null it as we use the String to resolve it as a Destination
instance
                     jmsReplyTo = null;
+                    LOG.trace("Normalized JMSReplyTo destination name {} -> {}", before,
replyTo);
 
                     // try using destination resolver to lookup the destination
                     if (endpoint.getDestinationResolver() != null) {
                         jmsReplyTo = endpoint.getDestinationResolver().resolveDestinationName(session,
replyTo, endpoint.isPubSubDomain());
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("Resolved JMSReplyTo destination {} using DestinationResolver
{} as PubSubDomain {} -> ",
+                                    new Object[]{replyTo, endpoint.getDestinationResolver(),
endpoint.isPubSubDomain(), jmsReplyTo});
+                        }
                     }
                     if (jmsReplyTo == null) {
                         // okay then fallback and create the queue
@@ -331,9 +340,11 @@ public class JmsProducer extends Default
                     JmsMessageHelper.setJMSReplyTo(answer, replyTo);
                 } else {
                     // do not use JMSReplyTo
+                    log.trace("Not using JMSReplyTo");
                     JmsMessageHelper.setJMSReplyTo(answer, null);
                 }
 
+                LOG.trace("Created javax.jms.Message: {}", answer);
                 return answer;
             }
         };



Mime
View raw message