camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <>
Subject Which type of error handling goes well with the .validate() DSL?
Date Mon, 01 Aug 2016 15:03:56 GMT
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 <>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message