Hi Yeah or if you use Main to startup Camel you can configure its duration options to number of max messages, time, etc. http://static.javadoc.io/org.apache.camel/camel-core/2.20.2/org/apache/camel/Main.html
On Thu, Mar 15, 2018 at 3:11 PM, Kris Easter <[email protected]> wrote: > > 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 > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
