I'm just getting started with using Camel and integrating it for new
work into an existing batch based legacy workflow. It seems easiest,
for now, to use in the legacy workflow if we can execute the Camel job
and then completely exit.
This seems to accomplish that:
from("timer://runOnce?repeatCount=1").to("direct:doTheWork")
.onCompletion().parallelProcessing().to("direct:shutdown");
from("direct:shutdown").id("shutdownRoute").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
getContext().getShutdownStrategy().setTimeout(60);
getContext().getShutdownStrategy()
.setLogInflightExchangesOnTimeout(false);
getContext().stop();
}
});
Is there a better way to accomplish this? Are there hidden dangers in
the approach above?
Thanks,
Kris