Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0D0218DF8 for ; Sun, 3 Jan 2016 14:28:23 +0000 (UTC) Received: (qmail 62995 invoked by uid 500); 3 Jan 2016 14:28:23 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 62880 invoked by uid 500); 3 Jan 2016 14:28:23 -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 62739 invoked by uid 99); 3 Jan 2016 14:28:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Jan 2016 14:28:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5A271E083A; Sun, 3 Jan 2016 14:28:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Sun, 03 Jan 2016 14:28:31 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Sun Jan 3 15:21:59 2016 +0100 Committer: Claus Ibsen 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. *

* 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