I have a common pattern right now of adding .validate() to several REST DSL
params since the .required() swagger DSL appears to be a suggestion and not
a validation. Since my REST DSL is spread across several routes, I'd like
to use some sort of shared error handling. Now I see there are two good
methods here that I'm debating between:

1. Use onException() in an abstract class and have all my RouteBuilders
inherit from that in order to reuse the same onException() block (which is
somewhat annoying because if you use the XML DSL instead, the same
<onException/> applies to the whole CamelContext apparently, but not when
you use the Java DSL).

2. Export an ErrorHandlerFactory service bean and reuse that in each
RouteBuilder on the specific routes that have a .validate().

I'm using Camel 2.16.2 if that matters.

-- 
Matt Sicker <boa...@gmail.com>

Reply via email to