camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/6] git commit: CAMEL-6407: Include message history in stacktraces from error handler, making it easier to know where the problem was. Work in progress.
Date Fri, 31 May 2013 12:13:25 GMT
CAMEL-6407: Include message history in stacktraces from error handler, making it easier to
know where the problem was. Work in progress.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c2311c50
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c2311c50
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c2311c50

Branch: refs/heads/master
Commit: c2311c50ad7fc254562973679b02b8f9d93887a0
Parents: f0e11e6
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri May 31 14:04:44 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri May 31 14:06:54 2013 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/Exchange.java   |    1 +
 .../main/java/org/apache/camel/MessageHistory.java |   51 +++++++++++
 .../src/main/java/org/apache/camel/NamedNode.java  |    5 +
 .../apache/camel/impl/DefaultMessageHistory.java   |   58 +++++++++++++
 .../camel/model/ProcessorDefinitionHelper.java     |   35 --------
 .../org/apache/camel/model/RoutesDefinition.java   |    4 +
 .../camel/model/ThreadPoolProfileDefinition.java   |    5 +
 .../camel/processor/CamelInternalProcessor.java    |   35 +++++---
 .../camel/processor/RedeliveryErrorHandler.java    |    5 +-
 .../java/org/apache/camel/util/MessageHelper.java  |   44 ++++++++++-
 .../processor/MessageHistoryDumpRoutingTest.java   |   66 +++++++++++++++
 .../camel/blueprint/CamelContextFactoryBean.java   |   10 ++
 .../core/xml/AbstractCamelContextFactoryBean.java  |    5 +
 .../camel/spring/CamelContextFactoryBean.java      |   10 ++
 14 files changed, 283 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/Exchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/Exchange.java b/camel-core/src/main/java/org/apache/camel/Exchange.java
index 5e8a88d..9161430 100644
--- a/camel-core/src/main/java/org/apache/camel/Exchange.java
+++ b/camel-core/src/main/java/org/apache/camel/Exchange.java
@@ -153,6 +153,7 @@ public interface Exchange {
 
     String MAXIMUM_CACHE_POOL_SIZE     = "CamelMaximumCachePoolSize";
     String MAXIMUM_ENDPOINT_CACHE_SIZE = "CamelMaximumEndpointCacheSize";
+    String MESSAGE_HISTORY             = "CamelMessageHistory";
     String MULTICAST_INDEX             = "CamelMulticastIndex";
     String MULTICAST_COMPLETE          = "CamelMulticastComplete";
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/MessageHistory.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/MessageHistory.java b/camel-core/src/main/java/org/apache/camel/MessageHistory.java
new file mode 100644
index 0000000..e7e33f5
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/MessageHistory.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel;
+
+import java.util.Date;
+
+/**
+ * Represents the history of a Camel {@link Message} how it was routed by the Camel routing
engine.
+ */
+public interface MessageHistory {
+
+    /**
+     * Gets the route id at the point of this history.
+     */
+    String getRouteId();
+
+    /**
+     * Gets the node at the point of this history.
+     */
+    NamedNode getNode();
+
+    /**
+     * Gets the timestamp at the point of this history.
+     */
+    Date getTimestamp();
+
+    /**
+     * Gets the elapsed time in millis processing the node took
+     */
+    long getElapsed();
+
+    /**
+     * Used for signalling that processing of the node is done.
+     */
+    void nodeProcessingDone();
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/NamedNode.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/NamedNode.java b/camel-core/src/main/java/org/apache/camel/NamedNode.java
index 0e161ce..75065b6 100644
--- a/camel-core/src/main/java/org/apache/camel/NamedNode.java
+++ b/camel-core/src/main/java/org/apache/camel/NamedNode.java
@@ -31,6 +31,11 @@ public interface NamedNode {
     String getShortName();
 
     /**
+     * Returns a label to describe this node such as the expression if some kind of expression
node
+     */
+    String getLabel();
+
+    /**
      * Returns the description text or null if there is no description text associated with
this node
      */
     String getDescriptionText();

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistory.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistory.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistory.java
new file mode 100644
index 0000000..8e764dd
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultMessageHistory.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.impl;
+
+import java.util.Date;
+
+import org.apache.camel.MessageHistory;
+import org.apache.camel.NamedNode;
+import org.apache.camel.util.StopWatch;
+
+public class DefaultMessageHistory implements MessageHistory {
+
+    private final String routeId;
+    private final NamedNode node;
+    private final Date timestamp;
+    private final StopWatch stopWatch;
+
+    public DefaultMessageHistory(String routeId, NamedNode node, Date timestamp) {
+        this.routeId = routeId;
+        this.node = node;
+        this.timestamp = timestamp;
+        this.stopWatch = new StopWatch();
+    }
+
+    public String getRouteId() {
+        return routeId;
+    }
+
+    public NamedNode getNode() {
+        return node;
+    }
+
+    public Date getTimestamp() {
+        return timestamp;
+    }
+
+    public long getElapsed() {
+        return stopWatch.taken();
+    }
+
+    public void nodeProcessingDone() {
+        stopWatch.stop();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
index 4e1d153..6395ec6 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinitionHelper.java
@@ -24,7 +24,6 @@ import java.util.Set;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.spi.ExecutorServiceManager;
 import org.apache.camel.spi.RouteContext;
 import org.apache.camel.util.ObjectHelper;
@@ -467,38 +466,4 @@ public final class ProcessorDefinitionHelper {
         return null;
     }
 
-    @SuppressWarnings("unchecked")
-    public static String dumpMessageHistoryStacktrace(Exchange exchange, boolean logStackTrace)
{
-        List<ProcessorDefinition<?>> list = exchange.getProperty("CamelMessageHistory",
List.class);
-        if (list == null || list.isEmpty()) {
-            return null;
-        }
-
-        final String HEADER_FORMAT = "%-20s %-20s %-80s";
-        final String OUTPUT_FORMAT = "[%-18.18s] [%-18.18s] [%-78.78s]";
-
-        StringBuilder sb = new StringBuilder();
-        sb.append("\n");
-        sb.append("Message History\n");
-        sb.append("--------------------------------------------------------------------------------------------------------------------------\n");
-        sb.append(String.format(HEADER_FORMAT, "RouteId", "ProcessorId", "Processor"));
-        sb.append("\n");
-
-        for (ProcessorDefinition<?> node : list) {
-
-            String routeId = getRouteId(node);
-            String id = node.getId();
-            String label = node.getLabel();
-
-            sb.append(String.format(OUTPUT_FORMAT, routeId, id, label));
-            sb.append("\n");
-        }
-
-        if (logStackTrace) {
-            sb.append("\nStacktrace\n");
-            sb.append("--------------------------------------------------------------------------------------------------------------------------");
-        }
-        return sb.toString();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java b/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
index f6d4243..ab99fe0 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RoutesDefinition.java
@@ -65,6 +65,10 @@ public class RoutesDefinition extends OptionalIdentifiedDefinition<RoutesDefinit
         return "routes";
     }
 
+    public String getLabel() {
+        return "Route " + getId();
+    }
+
     // Properties
     //-----------------------------------------------------------------------
     public List<RouteDefinition> getRoutes() {

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
b/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
index 7c01955..a20f379 100644
--- a/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/ThreadPoolProfileDefinition.java
@@ -53,6 +53,11 @@ public class ThreadPoolProfileDefinition extends OptionalIdentifiedDefinition<Th
     public ThreadPoolProfileDefinition() {
     }
 
+    @Override
+    public String getLabel() {
+        return "ThreadPoolProfile " + getId();
+    }
+
     public ThreadPoolProfileDefinition poolSize(int poolSize) {
         return poolSize("" + poolSize);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
b/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
index 6424099..87a0b3f 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/CamelInternalProcessor.java
@@ -25,15 +25,18 @@ import java.util.concurrent.RejectedExecutionException;
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
+import org.apache.camel.MessageHistory;
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.StatefulService;
 import org.apache.camel.api.management.PerformanceCounter;
+import org.apache.camel.impl.DefaultMessageHistory;
 import org.apache.camel.impl.DefaultUnitOfWork;
 import org.apache.camel.impl.MDCUnitOfWork;
 import org.apache.camel.management.DelegatePerformanceCounter;
 import org.apache.camel.management.mbean.ManagedPerformanceCounter;
 import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.model.ProcessorDefinitionHelper;
 import org.apache.camel.processor.interceptor.BacklogDebugger;
 import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.camel.processor.interceptor.DefaultBacklogTracerEventMessage;
@@ -55,6 +58,7 @@ import org.slf4j.LoggerFactory;
  *     <li>Gather JMX performance statics</li>
  *     <li>Tracing</li>
  *     <li>Debugging</li>
+ *     <li>Message History</li>
  * </ul>
  * ... and more.
  * <p/>
@@ -681,31 +685,38 @@ public class CamelInternalProcessor extends DelegateAsyncProcessor {
         }
     }
 
-    public static class MessageHistoryAdvice implements CamelInternalProcessorAdvice {
+    /**
+     * Advice when Message History has been enabled.
+     */
+    @SuppressWarnings("unchecked")
+    public static class MessageHistoryAdvice implements CamelInternalProcessorAdvice<MessageHistory>
{
 
         private final ProcessorDefinition<?> definition;
+        private final String routeId;
 
         public MessageHistoryAdvice(ProcessorDefinition<?> definition) {
             this.definition = definition;
+            this.routeId = ProcessorDefinitionHelper.getRouteId(definition);
         }
 
         @Override
-        @SuppressWarnings("unchecked")
-        public Object before(Exchange exchange) throws Exception {
-            List<ProcessorDefinition<?>> history = exchange.getProperty("CamelMessageHistory",
List.class);
-            if (history == null) {
-                history = new ArrayList<ProcessorDefinition<?>>();
-                exchange.setProperty("CamelMessageHistory", history);
+        public MessageHistory before(Exchange exchange) throws Exception {
+            List<MessageHistory> list = exchange.getProperty(Exchange.MESSAGE_HISTORY,
List.class);
+            if (list == null) {
+                list = new ArrayList<MessageHistory>();
+                exchange.setProperty(Exchange.MESSAGE_HISTORY, list);
             }
-            history.add(definition);
-            return null;
+            MessageHistory history = new DefaultMessageHistory(routeId, definition, new Date());
+            list.add(history);
+            return history;
         }
 
         @Override
-        public void after(Exchange exchange, Object data) throws Exception {
-            // noop
+        public void after(Exchange exchange, MessageHistory history) throws Exception {
+            if (history != null) {
+                history.nodeProcessingDone();
+            }
         }
-
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
index e038c66..4f0f0f8 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
@@ -30,7 +30,6 @@ import org.apache.camel.Message;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.model.OnExceptionDefinition;
-import org.apache.camel.model.ProcessorDefinitionHelper;
 import org.apache.camel.spi.ShutdownPrepared;
 import org.apache.camel.spi.SubUnitOfWorkCallback;
 import org.apache.camel.spi.UnitOfWork;
@@ -959,7 +958,7 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport
impleme
 
             // should we include message history
             if (!shouldRedeliver && data.currentRedeliveryPolicy.isLogExhaustedMessageHistory())
{
-                String routeStackTrace = ProcessorDefinitionHelper.dumpMessageHistoryStacktrace(exchange,
false);
+                String routeStackTrace = MessageHelper.dumpMessageHistoryStacktrace(exchange,
false);
                 if (routeStackTrace != null) {
                     msg = msg + "\n" + routeStackTrace;
                 }
@@ -976,7 +975,7 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport
impleme
             String msg = message;
             // should we include message history
             if (!shouldRedeliver && data.currentRedeliveryPolicy.isLogExhaustedMessageHistory())
{
-                String routeStackTrace = ProcessorDefinitionHelper.dumpMessageHistoryStacktrace(exchange,
e != null && logStackTrace);
+                String routeStackTrace = MessageHelper.dumpMessageHistoryStacktrace(exchange,
e != null && logStackTrace);
                 if (routeStackTrace != null) {
                     msg = msg + "\n" + routeStackTrace;
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
index 61be0f0..26f84b3 100644
--- a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
@@ -21,14 +21,15 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
 
 import org.apache.camel.BytesSource;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
+import org.apache.camel.MessageHistory;
 import org.apache.camel.StreamCache;
 import org.apache.camel.StringSource;
 import org.apache.camel.WrappedFile;
@@ -40,6 +41,9 @@ import org.apache.camel.WrappedFile;
  */
 public final class MessageHelper {
 
+    private static final String MESSAGE_HISTORY_HEADER = "%-20s %-20s %-80s %-12s";
+    private static final String MESSAGE_HISTORY_OUTPUT = "[%-18.18s] [%-18.18s] [%-78.78s]
[%10.10s]";
+
     /**
      * Utility classes should not have a public constructor.
      */
@@ -392,4 +396,42 @@ public final class MessageHelper {
         }
     }
 
+    /**
+     * Dumps the {@link MessageHistory} from the {@link Exchange} in a human readable format.
+     *
+     * @param exchange       the exchange
+     * @param logStackTrace  whether to include a header for the stacktrace, to be added
(not included in this dump).
+     * @return a human readable message history as a table
+     */
+    public static String dumpMessageHistoryStacktrace(Exchange exchange, boolean logStackTrace)
{
+        List<MessageHistory> list = exchange.getProperty(Exchange.MESSAGE_HISTORY,
List.class);
+        if (list == null || list.isEmpty()) {
+            return null;
+        }
+
+        StringBuilder sb = new StringBuilder();
+        sb.append("\n");
+        sb.append("Message History\n");
+        sb.append("---------------------------------------------------------------------------------------------------------------------------------------\n");
+        sb.append(String.format(MESSAGE_HISTORY_HEADER, "RouteId", "ProcessorId", "Processor",
"Elapsed (ms)"));
+        sb.append("\n");
+
+        for (MessageHistory history : list) {
+
+            String routeId = history.getRouteId();
+            String id = history.getNode().getId();
+            String label = history.getNode().getLabel();
+            long elapsed = history.getElapsed();
+
+            sb.append(String.format(MESSAGE_HISTORY_OUTPUT, routeId, id, label, elapsed));
+            sb.append("\n");
+        }
+
+        if (logStackTrace) {
+            sb.append("\nStacktrace\n");
+            sb.append("---------------------------------------------------------------------------------------------------------------------------------------");
+        }
+        return sb.toString();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/camel-core/src/test/java/org/apache/camel/processor/MessageHistoryDumpRoutingTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/MessageHistoryDumpRoutingTest.java
b/camel-core/src/test/java/org/apache/camel/processor/MessageHistoryDumpRoutingTest.java
new file mode 100644
index 0000000..2e042a5
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/MessageHistoryDumpRoutingTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+
+/**
+ * @version 
+ */
+public class MessageHistoryDumpRoutingTest extends ContextTestSupport {
+
+    public void testReduceStacksNeeded() throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:bar");
+        mock.expectedBodiesReceived("Hello World");
+
+        template.sendBody("seda:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setMessageHistory(true);
+
+                from("seda:start")
+                        .to("log:foo")
+                        .to("direct:bar")
+                        .delay(300)
+                        .to("log:baz")
+                        .process(new Processor() {
+                            @Override
+                            public void process(Exchange exchange) throws Exception {
+                                throw new IllegalArgumentException("Forced to dump message
history");
+                            }
+                        })
+                        .to("mock:result");
+
+                from("direct:bar")
+                    .to("log:bar")
+                    .delay(100)
+                    .to("mock:bar");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
index b89d066..8818c85 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -79,6 +79,8 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
     @XmlAttribute(required = false)
     private String trace;
     @XmlAttribute(required = false)
+    private String messageHistory;
+    @XmlAttribute(required = false)
     private String streamCache = "false";
     @XmlAttribute(required = false)
     private String delayer;
@@ -425,6 +427,14 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Blu
         this.trace = trace;
     }
 
+    public String getMessageHistory() {
+        return messageHistory;
+    }
+
+    public void setMessageHistory(String messageHistory) {
+        this.messageHistory = messageHistory;
+    }
+
     public String getStreamCache() {
         return streamCache;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
index c6e5bd3..d521e7d 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -468,6 +468,8 @@ public abstract class AbstractCamelContextFactoryBean<T extends ModelCamelContex
 
     public abstract String getTrace();
 
+    public abstract String getMessageHistory();
+
     public abstract String getStreamCache();
 
     public abstract String getDelayer();
@@ -530,6 +532,9 @@ public abstract class AbstractCamelContextFactoryBean<T extends ModelCamelContex
         if (getTrace() != null) {
             ctx.setTracing(CamelContextHelper.parseBoolean(getContext(), getTrace()));
         }
+        if (getMessageHistory() != null) {
+            ctx.setMessageHistory(CamelContextHelper.parseBoolean(getContext(), getMessageHistory()));
+        }
         if (getDelayer() != null) {
             ctx.setDelayer(CamelContextHelper.parseLong(getContext(), getDelayer()));
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/c2311c50/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
index efe2355..9fb2a91 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
@@ -88,6 +88,8 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
     @XmlAttribute(required = false)
     private String trace;
     @XmlAttribute(required = false)
+    private String messageHistory;
+    @XmlAttribute(required = false)
     private String streamCache;
     @XmlAttribute(required = false)
     private String delayer;
@@ -467,6 +469,14 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr
         this.trace = trace;
     }
 
+    public String getMessageHistory() {
+        return messageHistory;
+    }
+
+    public void setMessageHistory(String messageHistory) {
+        this.messageHistory = messageHistory;
+    }
+
     public String getStreamCache() {
         return streamCache;
     }


Mime
View raw message