Search code examples
apache-camelonexception

Injecting or Inheriting Router Builder for global onException in apache camel


I have onException configured in one DefaultRouteBuilder class. I want this onException in all other routes in my context. My doubt is whether I should inherit DefaultRouteBuilder in all other routes and calling super.configure() in configure() method or to inject DefaultRouteBuilder defaultRoute in all other RouteBuilder classes and calling defaultRoute.configure() in configure() method. Which one should be appropriate?


Solution

  • The global onException DSL only work inside of same RouteBuilder, as camelcontext treat the routebuilder instance separately.