-
1. Re: Camel shutdown and route threading
davsclaus Jun 22, 2009 1:23 AM (in response to bliessen_bliessen)Hi
1)
The is a scheduled poller, and as such it runs continuously.
You can configure the consumer.delay option to define how many milli seconds between eac poll.
http://camel.apache.org/file.html
It is a bit unusual to start, run once, shutdown an integration as they are often long lived within some existing server platform.
You want to use some external scheduler to invoke a Java App let it run once and then terminate?
You can more easily do this with Java code as you can control when to stop.
For instance look at the FTP sample (Consuming a remote FTP server triggered by a route)
http://camel.apache.org/ftp.html
For instance you can control it just as in regular Java code in the main class.
public static void main(String... args)
Where you in Java code create a PollingConsumer and then you can do in a loop invoke the receive() method. And as long the result != null then you got a file.
Then you can process this file.
2)
About parallel execution. You can use the .thread(5) DSL to use concurrency. It will use a thread pool with 5 concurrent threads.
In Camel 2.0 this has been greatly enhanced and there is some background info here
The 1.x old API
http://camel.apache.org/asynchronous-processing.html
The 2.0 new API
http://camel.apache.org/async.html
And other:
http://camel.apache.org/parallel-processing-and-ordering.html