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/07030583 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/07030583 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/07030583 Branch: refs/heads/camel-2.16.x Commit: 070305832c0f504fdd29a4eae58d7566d37e777e Parents: ae75d8d Author: Claus Ibsen <davscl...@apache.org> Authored: Sun Jan 3 15:21:59 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Jan 3 17:54:24 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/07030583/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