camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arkadi Shishlov" <>
Subject Re: Using Apache Camel as replacement for cron-driven shell scripts
Date Thu, 07 Apr 2011 13:33:15 GMT
It is perfectly reasonable and doable, please see comments inline.

On Thu, 07 Apr 2011 13:24:02 +0300, Andrey Popp <> wrote:
> I'm wondering of the following setup:
>   * Apache Camel running as daemon.

In our project we pack Camel with maven-shade-plugin into uber-jar and  
launch it under nohup java -jar.
I do not have an access to wiki, but I can send you pom.xml and custom, or publish it here for reference.

>   * Ability to submit new routes' configuration from command line (as of  
> CAMEL-1004
>     it seem Apache Camel is able to replace routes at runtime) as plain  
> Java/Scala
>     code files.

Dynamic reconfiguration works. We start with from() and gradually build  
the route(s) based on database setup.
If you arrange a system to load Java code on demand, be it Java, Scala, or  
Groovy (to skip compile step), then:
1. instantiate a class that extends RouteBuilder and performs route  
construction in configure()
2. call camel.addRoute(builder)
3. done :)
We keep a "started routes" Map of String->List key-ed by database Id and  
shutdown old instances in front-to-back order [because our routes consists  
of multiple from() steps] via camel.stopRoute()+removeRoute().

>   * Apache Camel should try to compile routes and in the case of success  
> -- replace
>     current routes with the new ones.

The replace part could be tricky depending on your requirements. If you  
started a slightly different copy of the route, you may get duplicates or  
other undesirable behavior. But route definition should be tested before  
production somewhere else, so you can probably just shutdown old stuff  
before staring new one.

View raw message