camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r734681 - in /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor: DefaultTraceEventMessage.java TraceInterceptor.java Tracer.java
Date Thu, 15 Jan 2009 12:25:28 GMT
Author: davsclaus
Date: Thu Jan 15 04:25:27 2009
New Revision: 734681

URL: http://svn.apache.org/viewvc?rev=734681&view=rev
Log:
CAMEL-1245: JPA based trace events

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventMessage.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventMessage.java?rev=734681&r1=734680&r2=734681&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventMessage.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/DefaultTraceEventMessage.java
Thu Jan 15 04:25:27 2009
@@ -26,7 +26,7 @@
 import org.apache.camel.util.MessageHelper;
 
 /**
- * Default JPA based {@link TraceEventMessage}.
+ * Default {@link TraceEventMessage}.
  */
 public final class DefaultTraceEventMessage implements Serializable, TraceEventMessage {
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java?rev=734681&r1=734680&r2=734681&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java
Thu Jan 15 04:25:27 2009
@@ -23,6 +23,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.Endpoint;
 import org.apache.camel.model.InterceptorRef;
 import org.apache.camel.model.ProcessorType;
 import org.apache.camel.processor.DelegateProcessor;
@@ -152,7 +153,7 @@
 
     protected void traceExchange(Exchange exchange) throws Exception {
         // should we send a trace event to an optional destination?
-        if (tracer.getDestinationUri() != null) {
+        if (tracer.getDestination() != null || tracer.getDestinationUri() != null) {
             // create event and add it as a property on the original exchange
             TraceEventExchange event = new TraceEventExchange(exchange);
             Date timestamp = new Date();
@@ -163,7 +164,7 @@
             // create event message to send in body
             TraceEventMessage msg = new DefaultTraceEventMessage(timestamp, node, exchange);
 
-            // should we use ordinay or jpa objects
+            // should we use ordinary or jpa objects
             if (tracer.isUseJpa()) {
                 LOG.trace("Using class: " + JPA_TRACE_EVENT_MESSAGE + " for tracing event
messages");
 
@@ -173,7 +174,7 @@
                         jpaTraceEventMessageClass = ObjectHelper.loadClass(JPA_TRACE_EVENT_MESSAGE);
                         if (jpaTraceEventMessageClass == null) {
                             throw new IllegalArgumentException("Cannot find class: " + JPA_TRACE_EVENT_MESSAGE
-                                    + ". Make sure camel-jpa.jar is on the classpath.");
+                                    + ". Make sure camel-jpa.jar is in the classpath.");
                         }
                     }
                 }
@@ -249,7 +250,8 @@
     private synchronized Producer getTraceEventProducer(Exchange exchange) throws Exception
{
         if (traceEventProducer == null) {
             // create producer when we have access the the camel context (we dont in doStart)
-            traceEventProducer = exchange.getContext().getEndpoint(tracer.getDestinationUri()).createProducer();
+            Endpoint endpoint = tracer.getDestination() != null ? tracer.getDestination()
: exchange.getContext().getEndpoint(tracer.getDestinationUri());
+            traceEventProducer = endpoint.createProducer();
             ServiceHelper.startService(traceEventProducer);
         }
         return traceEventProducer;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java?rev=734681&r1=734680&r2=734681&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java
Thu Jan 15 04:25:27 2009
@@ -21,6 +21,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
+import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.model.LoggingLevel;
 import org.apache.camel.model.ProcessorType;
@@ -42,6 +43,7 @@
     private boolean traceExceptions = true;
     private boolean traceOutExchanges;
     private String destinationUri;
+    private Endpoint destination;
     private boolean useJpa;
 
     /**
@@ -175,6 +177,17 @@
         this.destinationUri = destinationUri;
     }
 
+    public Endpoint getDestination() {
+        return destination;
+    }
+
+    /**
+     * See {@link #setDestinationUri(String)}
+     */
+    public void setDestination(Endpoint destination) {
+        this.destination = destination;
+    }
+
     public boolean isUseJpa() {
         return useJpa;
     }



Mime
View raw message