I am creating routes dynamically using a custom processor listening to a "control route". It creates the routes depending on the message content which is sent to the control route. It is used to dynamically create FTP/file endpoints by another system.
I'm using Camel as blueprint bundle inside ServiceMix and Hawtio to control the state of the routes (e.g. suspend them).
It works fine but (logically) these routes are not recognized if the camel context is restarted because there is no persistent route configuration.
Is there some best practice on how to persist the routes?
I'm thinking of re-creating the routes from reading the directory structure of the file endpoints or using a database to persist the routes and their state.
we had the same scenario and chose to use a database table to store the meta data about each route and reconstruct the routes on startup...this is pretty easy assuming your routes are fairly static in nature.
we also considered adding the route as Spring DSL/XML to a file and loading it on startup. But we chose the database approach because we also needed to expose this meta data to a UI to manage the routing configs, etc. Then simply listen for changes to the config and remove/re-add routes as needed, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With