camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: [DISCUSS] - API change on org.apache.camel.spi.ExceptionHandler
Date Mon, 10 Sep 2012 13:47:09 GMT

What about a:

public interface SourceAwareExceptionHandler extends ExceptionHandler {
  …add three methods….
}

Thus, no "old" code needs to change at all unless they want to use the new methods.   They
would need an instanceof if they do want to use the new methods.

HOWEVER, we could also do an instanceof during the addExceptionHandler and wrapper any non-SourceAwareExceptionHandler
handler with an instance that would forward all the methods to the old methods (dropping the
source).   Thus, all calls to getExceptionHandler would be given a SourceAware version.

Dan



On Sep 10, 2012, at 6:56 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> Hi
> 
> See ticket, and if you got the time the nabble link
> https://issues.apache.org/jira/browse/CAMEL-5587
> 
> The API on org.apache.camel.spi.ExceptionHandler has 3 methods for
> handling exceptions,
> 
> CAMEL-5587 is a ticket to enhance that API with a new parameter that
> has the source that called the handler.
> This allows end users to know the source, and get additional details,
> such as if it was from a consumer, which consumer
> and the endpoint etc.
> 
> This is needed when you for example have a custom exception handler
> and use it for many Camel endpoints (routes etc).
> 
> Mind this only affects either
> - component writers if using this API
> - end users if using a custom exception handler.
> Both of these cases is not often used.
> 
> 
> 
> As this API is not backwards compatible we could
> a) wait for Camel 3.0
> b) introduce the change
> c) introduce the change, but add the 3 old methods to
> org.apache.camel.spi.ExceptionHandler and mark the as @deprecated
> 
> Ad a)
> We can wait a long time then.
> 
> Ad b)
> This requires older components to be recompiled to support newer Camel
> releases (if the component uses the API directly).
> 
> Ad c)
> This allows older components to be compatible with newer Camel
> releases (if the component uses the API directly).
> 
> 
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message