The endpoints are strings - nothing prevents you from externalising such
information (say in a config file) and then build the endpoint urls
based on values in there that you read in at start-up time. Processors
can be equally created 'late'. If the class you are using has state you
can insantiate it from within the routebuilder also
Let me know if you need something more concrete - hopefully this makes sense
On 29/10/2011 06:26, tkatva wrote:
Hi
I am newbie with Camel and it seems to be very powerful framework. One thing
that I haven't found out yet is that how can you create routes
programmatically/dynamically?
So let's say I created following code :
camel = new DefaultCamelContext();
camel.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file:C:\\FtpTestFolders\\FtpOut?delete=true")
.setHeader(Exchange.FILE_NAME,
constant("TestiPrkl.txt"))
.to("file:C:\\FtpTestFolders\\FtpIn")
.setHeader(Exchange.FILE_NAME,
constant("ToinenTestiPrkl.txt"))
.to("file:C:\\FtpTestFolders\\FtpError");
//Here I may or may not want to add other headers,
endpoints and processors
}
});
This is fine but what if I have defined my headers and endpoint in somewhere
else (db/file/etc) and I wan't to create routes based on these dynamically.
The API is quite complex so if someone could post me an example I would
really appreciate it.
Thank you
--
View this message in context:
http://camel.465427.n5.nabble.com/Creating-routes-dynamically-tp4948062p4948062.html
Sent from the Camel - Users mailing list archive at Nabble.com.