CamelContext doesn't startup if one route is misconfigured

拥有回忆 提交于 2019-12-11 04:12:45

问题


We use Java DSL to configure our routes. All configurations for routes are in a db table and can be configured via a GUI.

How is it possible to ensure that the camelContext starts up even if a route is misconfigured (e.g. .to(invalidurl or typo) in a route or simply a bug in a route)?

Is there a possibilty to validate the routes before starting or maybe better some parameters/options which can be set on the context itself?


回答1:


You can configure the routes with .autoStartup(false), and then start the routes manually when CamelContext has been started up.

To validate its really depending on what kind of component it is. If its some database component you can write some code that does a SQL query to see if the is valid user login or something.

To validate that an endpoint uri is misconfigured, then that is harder as they have a ton of options. But this is getting improved from Camel 2.16 onwards where we have during build time some tooling that generates a json schema file with the options, then we could potentially leverage that during parsing the routes to check for invalid configuration before attempting to create the endpoints which could detect errors sooner, and even also with IDE plugins or other 3rd party tooling.




回答2:


Can you just before adding every route to the context, add it to a separate "test" context individually, and see if it spins up or fails; then based on that add it to your real context?



来源:https://stackoverflow.com/questions/30620130/camelcontext-doesnt-startup-if-one-route-is-misconfigured

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!