InterceptStrategy is not most direct work to do it, but it doesn’t leverage the
camel error handler facility.
If you just want to catch certain exception, you can do it by apply the
ExceptionPolicyStrategy to the ErrorHandler like this
errorHandler(deadLetterChannel("mock:error").exceptionPolicyStrategy(new
MyPolicy()));
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
(English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Tuesday, November 26, 2013 at 6:46 AM, Henrique Viecili wrote:
> bumping...
>
> anyone?
>
> I've posted the same question on StackOverflow:
> http://stackoverflow.com/questions/19779558/best-way-to-build-a-container-wide-exception-handler-in-osgi-with-camel
> if
> you want to get some more reputation :)
>
> Henrique Viecili
>
>
> On 4 November 2013 15:01, Henrique Viecili <[email protected]
> (mailto:[email protected])> wrote:
>
> > Hi guys,
> >
> > I would like to build a container-wide exception handler and would like to
> > know what's the best option to go considering I'm running my routes in an
> > OSGi environment (JBoss Fuse) deployed with Blueprint DSL.
> >
> >
> > *Option 1.*
> > I read about implementing an InterceptStrategy and expose it as a provided
> > service and later reuse it in other bundles just by declaring <reference
> > id="ewEH"
> > interface="com.test.interceptor.EnvelopeWrapperEHInterceptStrategy"
> > /> inside my blueprint.xml
> >
> > Is this the best option to go? What would be the best way to trigger the
> > interceptor only when an unhandled exception happens in my routes?
> >
> >
> > *Option 2.*
> > Another way I thought was to override
> > org.apache.camel.processor.exceptionpolicy.DefaultExceptionPolicyStrategy
> > , but then how should I expose this as a blueprint service that other
> > bundles could reference for camel to pick it up in a transparent way?
> >
> >
> > *Option 3. *
> > Something else?!?
> >
> >
> > Regards,
> > Henrique Viecili
>