Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 91679 invoked from network); 4 Jul 2009 07:52:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jul 2009 07:52:51 -0000 Received: (qmail 95615 invoked by uid 500); 4 Jul 2009 07:53:02 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 95574 invoked by uid 500); 4 Jul 2009 07:53:02 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 95565 invoked by uid 99); 4 Jul 2009 07:53:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jul 2009 07:53:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Jul 2009 07:52:58 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2CAC82388877; Sat, 4 Jul 2009 07:52:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r791077 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/processor/interceptor/ camel-core/src/test/java/org/apache/camel/processor/interceptor/ examples/camel-example-tracer/ Date: Sat, 04 Jul 2009 07:52:36 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090704075237.2CAC82388877@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Sat Jul 4 07:52:36 2009 New Revision: 791077 URL: http://svn.apache.org/viewvc?rev=791077&view=rev Log: CAMEL-1078: Removed last specialized Exchange the TraceEventExchange. Removed: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceEventExchange.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java camel/trunk/examples/camel-example-tracer/pom.xml Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=791077&r1=791076&r2=791077&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Sat Jul 4 07:52:36 2009 @@ -85,10 +85,10 @@ String ON_COMPLETION = "CamelOnCompletion"; - String ROUTE_STOP = "CamelRouteStop"; - + String ROUTE_STOP = "CamelRouteStop"; String REDELIVERED = "CamelRedelivered"; String REDELIVERY_COUNTER = "CamelRedeliveryCounter"; + String ROLLBACK_ONLY = "CamelRollbackOnly"; String SPLIT_INDEX = "CamelSplitIndex"; String SPLIT_SIZE = "CamelSplitSize"; @@ -98,8 +98,12 @@ String TIMER_PERIOD = "CamelTimerPeriod"; String TIMER_TIME = "CamelTimerTime"; - String TRANSACTED = "CamelTransacted"; - String ROLLBACK_ONLY = "CamelRollbackOnly"; + String TRANSACTED = "CamelTransacted"; + + String TRACE_EVENT = "CamelTraceEvent"; + String TRACE_EVENT_NODE_ID = "CamelTraceEventNodeId"; + String TRACE_EVENT_TIMESTAMP = "CamelTraceEventTimestamp"; + String TRACE_EVENT_EXCHANGE = "CamelTraceEventExchange"; /** * Returns the {@link ExchangePattern} (MEP) of this exchange. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java?rev=791077&r1=791076&r2=791077&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceInterceptor.java Sat Jul 4 07:52:36 2009 @@ -26,6 +26,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.impl.DefaultRouteNode; +import org.apache.camel.impl.DefaultExchange; import org.apache.camel.model.InterceptDefinition; import org.apache.camel.model.OnCompletionDefinition; import org.apache.camel.model.OnExceptionDefinition; @@ -49,7 +50,6 @@ public class TraceInterceptor extends DelegateProcessor implements ExchangeFormatter { private static final transient Log LOG = LogFactory.getLog(TraceInterceptor.class); private static final String JPA_TRACE_EVENT_MESSAGE = "org.apache.camel.processor.interceptor.JpaTraceEventMessage"; - private static final String TRACE_EVENT = "CamelTraceEvent"; private Logger logger; private Producer traceEventProducer; private final ProcessorDefinition node; @@ -93,7 +93,7 @@ public void process(final Exchange exchange) throws Exception { // interceptor will also trace routes supposed only for TraceEvents so we need to skip // logging TraceEvents to avoid infinite looping - if (exchange instanceof TraceEventExchange || exchange.getProperty(TRACE_EVENT, Boolean.class) != null) { + if (exchange.getProperty(Exchange.TRACE_EVENT, Boolean.class) != null) { // but we must still process to allow routing of TraceEvents to eg a JPA endpoint super.process(exchange); return; @@ -285,14 +285,17 @@ protected void traceExchange(Exchange exchange) throws Exception { // should we send a trace event to an optional destination? if (tracer.getDestination() != null || tracer.getDestinationUri() != null) { - // create event and add it as a property on the original exchange - TraceEventExchange event = new TraceEventExchange(exchange); + + // create event exchange and add event information Date timestamp = new Date(); - event.setNodeId(node.getId()); - event.setTimestamp(timestamp); - event.setTracedExchange(exchange); + Exchange event = new DefaultExchange(exchange); + event.setProperty(Exchange.TRACE_EVENT_NODE_ID, node.getId()); + event.setProperty(Exchange.TRACE_EVENT_TIMESTAMP, timestamp); + // keep a reference to the original exchange in case its needed + event.setProperty(Exchange.TRACE_EVENT_EXCHANGE, exchange); - // create event message to send in body + // create event message to sent as in body containing event information such as + // from node, to node, etc. TraceEventMessage msg = new DefaultTraceEventMessage(timestamp, node, exchange); // should we use ordinary or jpa objects @@ -327,13 +330,13 @@ // marker property to indicate its a tracing event being routed in case // new Exchange instances is created during trace routing so we can check // for this marker when interceptor also kickins in during routing of trace events - event.setProperty(TRACE_EVENT, Boolean.TRUE); + event.setProperty(Exchange.TRACE_EVENT, Boolean.TRUE); try { // process the trace route getTraceEventProducer(exchange).process(event); } catch (Exception e) { // log and ignore this as the original Exchange should be allowed to continue - LOG.error("Error processing TraceEventExchange (original Exchange will be continued): " + event, e); + LOG.error("Error processing trace event (original Exchange will continue): " + event, e); } } } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java?rev=791077&r1=791076&r2=791077&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/Tracer.java Sat Jul 4 07:52:36 2009 @@ -175,7 +175,7 @@ } /** - * Sets an optional destination to send the traced Exchange wrapped in a {@link TraceEventExchange}. + * Sets an optional destination to send the traced Exchange. *

* Can be used to store tracing as files, in a database or whatever. The routing of the Exchange * will happen synchronously and the original route will first continue when this destination routing Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java?rev=791077&r1=791076&r2=791077&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/TraceInterceptorDestinationTest.java Sat Jul 4 07:52:36 2009 @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Date; import org.apache.camel.ContextTestSupport; import org.apache.camel.Exchange; @@ -129,11 +130,10 @@ class MyTraveAssertProcessor implements Processor { public void process(Exchange exchange) throws Exception { - TraceEventExchange event = (TraceEventExchange) exchange; - assertNotNull(event); - assertEquals(event.getExchangeId(), exchange.getExchangeId()); - assertNotNull(event.getNodeId()); - assertNotNull(event.getTimestamp()); + String nodeId = exchange.getProperty("CamelTraceEventNodeId", String.class); + Date timestamp = exchange.getProperty("CamelTraceEventTimestamp", Date.class); + assertNotNull(nodeId); + assertNotNull(timestamp); // take a snapshot at current time for assertion later // after mock assertions in unit test method Modified: camel/trunk/examples/camel-example-tracer/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-tracer/pom.xml?rev=791077&r1=791076&r2=791077&view=diff ============================================================================== --- camel/trunk/examples/camel-example-tracer/pom.xml (original) +++ camel/trunk/examples/camel-example-tracer/pom.xml Sat Jul 4 07:52:36 2009 @@ -69,14 +69,6 @@ org.apache.geronimo.specs geronimo-jta_1.1_spec - - commons-dbcp - commons-dbcp - - - commons-collections - commons-collections -