git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run route and then stop context



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




( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-camel-users/msg03146.html on line 105
Call Stack
#TimeMemoryFunctionLocation
10.0006363544{main}( ).../msg03146.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-camel-users/msg03146.html on line 105
Call Stack
#TimeMemoryFunctionLocation
10.0006363544{main}( ).../msg03146.html:0