Reputation: 3407
I am new to Camel and was thinking of writing a new module for our project by using it. It will be connecting to multiple endpoints like mail rss jms ftp etc for this. One thing I don't understand is when to know that its safe to stop the context (all downloads are over).
In almost all tutorials I could see till now I see
context.start();
Thread.sleep();
context.stop();
I am looking for a better way than sleeping in between to finish the camel threads
Upvotes: 1
Views: 5502
Reputation: 28655
You can use RoutePolicy
to control routes at runtime.
For more details Click Here
Also check How can I stop a route from a route
Check the example Controlling Start-Up and Shutdown of Routes
If you can get the Camel In Action read the section 13.2 Starting and stopping routes at runtime
Hope above link might help you.
Upvotes: 4