Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to persist dynamically created camel routes?

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.

like image 327
Michael Brohl Avatar asked Feb 18 '15 13:02

Michael Brohl


1 Answers

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.

like image 137
Ben ODay Avatar answered Oct 23 '22 13:10

Ben ODay