You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/03 15:28:31 UTC
[9/9] camel git commit: CAMEL-9470: Add missing errorHandler
(consumer) option to component docs
CAMEL-9470: Add missing errorHandler (consumer) option to component docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/effc3f29
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/effc3f29
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/effc3f29
Branch: refs/heads/master
Commit: effc3f294f569858efdf57b35b8526a4377f4c68
Parents: bfc39e0
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jan 3 15:21:59 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jan 3 15:22:34 2016 +0100
----------------------------------------------------------------------
.../org/apache/camel/impl/DefaultEndpoint.java | 28 +++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/effc3f29/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
index 0bf9e74..cf6461e 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java
@@ -29,6 +29,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.PollingConsumer;
import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.spi.ExceptionHandler;
import org.apache.camel.spi.HasId;
import org.apache.camel.spi.UriParam;
import org.apache.camel.support.ServiceSupport;
@@ -61,8 +62,12 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint
private Component component;
@UriParam(label = "consumer", optionalPrefix = "consumer.", description = "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while"
+ " the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler."
- + " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,that by default will be logged at WARN/ERROR level and ignored.")
+ + " By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.")
private boolean bridgeErrorHandler;
+ @UriParam(label = "consumer,advanced", optionalPrefix = "consumer.", description = "To let the consumer use a custom ExceptionHandler."
+ + " Notice if the option bridgeErrorHandler is enabled then this options is not in use."
+ + " By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.")
+ private ExceptionHandler exceptionHandler;
@UriParam(defaultValue = "InOnly", label = "advanced",
description = "Sets the default exchange pattern when creating an exchange")
private ExchangePattern exchangePattern = ExchangePattern.InOnly;
@@ -291,12 +296,25 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint
* handled by the routing Error Handler.
* <p/>
* By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions,
- * that by default will be logged at WARN/ERROR level and ignored.
+ * that will be logged at WARN/ERROR level and ignored.
*/
public void setBridgeErrorHandler(boolean bridgeErrorHandler) {
this.bridgeErrorHandler = bridgeErrorHandler;
}
+ public ExceptionHandler getExceptionHandler() {
+ return exceptionHandler;
+ }
+
+ /**
+ * To let the consumer use a custom ExceptionHandler.
+ + Notice if the option bridgeErrorHandler is enabled then this options is not in use.
+ + By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.
+ */
+ public void setExceptionHandler(ExceptionHandler exceptionHandler) {
+ this.exceptionHandler = exceptionHandler;
+ }
+
/**
* Gets the {@link org.apache.camel.PollingConsumer} queue size, when {@link org.apache.camel.impl.EventDrivenPollingConsumer}
* is being used. Notice some Camel components may have their own implementation of {@link org.apache.camel.PollingConsumer} and
@@ -496,10 +514,14 @@ public abstract class DefaultEndpoint extends ServiceSupport implements Endpoint
@Override
protected void doStart() throws Exception {
- // the bridgeErrorHandler was orignally configured as consumer.bridgeErrorHandler so map to that style
+ // the bridgeErrorHandler/exceptionHandler was originally configured with consumer. prefix, such as consumer.bridgeErrorHandler=true
+ // so if they have been configured on the endpoint then map to the old naming style
if (bridgeErrorHandler) {
getConsumerProperties().put("bridgeErrorHandler", "true");
}
+ if (exceptionHandler != null) {
+ getConsumerProperties().put("exceptionHandler", exceptionHandler);
+ }
}
@Override