camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-9558: Fixed error handler to not log already handled exceptions.
Date Fri, 05 Feb 2016 15:56:33 GMT
CAMEL-9558: Fixed error handler to not log already handled exceptions.


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

Branch: refs/heads/camel-2.16.x
Commit: c9b7ddaa47fb52002f1a5b48fdb813ed4fb0748a
Parents: 27e1fe9
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Feb 5 16:18:52 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Feb 5 16:55:17 2016 +0100

----------------------------------------------------------------------
 .../camel/builder/DeadLetterChannelBuilder.java       |  2 ++
 .../camel/processor/RedeliveryErrorHandler.java       | 14 ++------------
 ...adLetterChannelLogExhaustedMessageHistoryTest.java |  4 +++-
 ...eadLetterChannelLogExhaustedMessageHistoryTest.xml |  2 +-
 ...aultErrorHandlerLogExhaustedMessageHistoryTest.xml |  2 +-
 ...eadLetterChannelLogExhaustedMessageHistoryTest.xml |  2 +-
 ...aultErrorHandlerLogExhaustedMessageHistoryTest.xml |  2 +-
 7 files changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
b/camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
index 646ed2d..c33b043 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
@@ -44,6 +44,8 @@ public class DeadLetterChannelBuilder extends DefaultErrorHandlerBuilder
{
 
     public DeadLetterChannelBuilder(Endpoint deadLetter) {
         setDeadLetter(deadLetter);
+        // DLC do not log exhausted by default
+        getRedeliveryPolicy().setLogExhausted(false);
     }
 
     public DeadLetterChannelBuilder(String uri) {

http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/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 04784eb..d99e5cf 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
@@ -1064,18 +1064,8 @@ public abstract class RedeliveryErrorHandler extends ErrorHandlerSupport
impleme
 
             // if we should not rollback, then check whether logging is enabled
 
-            // depending on what kind of error handler we should
-            boolean logExhausted;
-            if (isDeadLetterChannel) {
-                // if DLC then log exhausted should not be default
-                logExhausted = data.currentRedeliveryPolicy.getLogExhaustedMessageHistory()
!= null && data.currentRedeliveryPolicy.isLogExhaustedMessageHistory();
-            } else {
-                // for any other error handler log exhausted should be default
-                logExhausted = data.currentRedeliveryPolicy.getLogExhaustedMessageHistory()
== null || data.currentRedeliveryPolicy.isLogExhaustedMessageHistory();
-            }
-
-            if (!newException && handled && (!data.currentRedeliveryPolicy.isLogHandled()
&& !logExhausted)) {
-                // do not log handled (but log exhausted message history can overrule log
handled)
+            if (!newException && handled && !data.currentRedeliveryPolicy.isLogHandled())
{
+                // do not log handled
                 return;
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.java
b/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.java
index f691b25..d51a493 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.java
@@ -35,7 +35,9 @@ public class DeadLetterChannelLogExhaustedMessageHistoryTest extends ContextTest
             @Override
             public void configure() throws Exception {
                 // no delay to speedup test
-                errorHandler(deadLetterChannel("mock:dead").redeliveryDelay(0).maximumRedeliveries(3).logExhaustedMessageHistory(true));
+                errorHandler(deadLetterChannel("mock:dead").redeliveryDelay(0).maximumRedeliveries(3)
+                        // need to turn on logging handled and exhausted to see this with
DLC
+                        .logHandled(true).logExhausted(true).logExhaustedMessageHistory(true));
 
                 from("direct:start")
                     .log("Incoming ${body}")

http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
index 00eef48..c597809 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
@@ -29,7 +29,7 @@
   <camelContext errorHandlerRef="eh" xmlns="http://camel.apache.org/schema/spring">
 
     <errorHandler id="eh" type="DeadLetterChannel" deadLetterUri="mock:dead">
-      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logExhaustedMessageHistory="true"/>
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logHandled="true"
logExhausted="true" logExhaustedMessageHistory="true"/>
     </errorHandler>
 
     <route>

http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
index 7af32c1..67f83e2 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
@@ -29,7 +29,7 @@
   <camelContext errorHandlerRef="eh" xmlns="http://camel.apache.org/schema/spring">
 
     <errorHandler id="eh">
-      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logExhaustedMessageHistory="true"/>
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logExhausted="true"
logExhaustedMessageHistory="true"/>
     </errorHandler>
 
     <route>

http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
index d6a925e..ae4cd90 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DeadLetterChannelLogExhaustedMessageHistoryTest.xml
@@ -27,7 +27,7 @@
   <camelContext errorHandlerRef="eh" xmlns="http://camel.apache.org/schema/blueprint">
 
     <errorHandler id="eh" type="DeadLetterChannel" deadLetterUri="mock:dead">
-      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logExhaustedMessageHistory="true"/>
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logHandled="true"
logExhausted="true" logExhaustedMessageHistory="true"/>
     </errorHandler>
 
     <route>

http://git-wip-us.apache.org/repos/asf/camel/blob/c9b7ddaa/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
index ffb3f8a..17b2233 100644
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/DefaultErrorHandlerLogExhaustedMessageHistoryTest.xml
@@ -27,7 +27,7 @@
   <camelContext errorHandlerRef="eh" xmlns="http://camel.apache.org/schema/blueprint">
 
     <errorHandler id="eh">
-      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logExhaustedMessageHistory="true"/>
+      <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="0" logExhausted="true"
logExhaustedMessageHistory="true"/>
     </errorHandler>
 
     <route>


Mime
View raw message