You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Hossein <ma...@csc.com> on 2010/07/29 16:35:30 UTC

Dynamic Routes

Hello,

Is there anyway to dynamically setup routes? For example, I'm trying to
setup a route using a File component. In that file there will be something
like the following:
MQ_USERS_DATA_TOPIC=/the/file/location

I would like to read this file and then setup a route from above folder to
MQ_USERS_DATA_TOPIC

The content of the above file would be dynamic and the mapping of TOPIC /
file location could grow or shrink.

Thanks


-- 
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Routes-tp2256730p2256730.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Routes

Posted by Willem Jiang <wi...@gmail.com>.
There are two ways to accomplish your task.
A more easy way:
Camel supports to start and stop the RouteDefintion dynamically,
You can create the RouteDefintion yourself after you reading the file.

A hack way:
If you have the common procedure to handle the files, you can define the 
common route which start with a Direct endpoint like "direct:start".
Then you can do the following things:
1. Creating the FileEndpoint FileEndpoint yourself according the 
configure file
2, Creating a SendProcessor which destination is direct endpoint,
3. Creating the FileConsumer with the SendProcessor
4. Manage the FileEndpoint lifecyle yourself.

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open Source Integration http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang

Hossein wrote:
> Hello,
> 
> Is there anyway to dynamically setup routes? For example, I'm trying to
> setup a route using a File component. In that file there will be something
> like the following:
> MQ_USERS_DATA_TOPIC=/the/file/location
> 
> I would like to read this file and then setup a route from above folder to
> MQ_USERS_DATA_TOPIC
> 
> The content of the above file would be dynamic and the mapping of TOPIC /
> file location could grow or shrink.
> 
> Thanks
> 
>