How to save dynamically created camel routes?

I dynamically create routes using a custom processor that listens for a โ€œcontrol route.โ€ It creates routes based on the contents of the message that is sent to the management route. It is used to dynamically create FTP endpoints / files by another system.

I use Camel as a plan in ServiceMix and Hawtio to control the status of routes (for example, pause them).

It works fine, but (logically) these routes are not recognized if the camel context is restarted because there is no permanent route configuration.

Is there any best practice for saving routes?

I'm thinking of re-creating routes from reading the directory structure of the endpoints of a file or using a database to save routes and their status.

+6
source share
1 answer

we had the same scenario, and we decided to use a database table to store metadata about each route and recreate the routes at startup ... it's pretty easy if your routes are pretty static in nature.

we also considered adding a route as Spring DSL / XML to a file and loading it at startup. But we chose the approach to the database, because we also needed to expose this metadata in the user interface for managing routing configurations, etc. Then just listen to the configuration changes and delete / re-add routes as needed, etc.

+7
source

Source: https://habr.com/ru/post/982680/


All Articles