camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Alternatives to Thread.sleep
Date Wed, 01 May 2013 05:49:52 GMT
Hi

1)
There is an inflight repository you can use to see if there is any
messages currently in progress.
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InflightRepository.html

You can get access to it from the CamelContext

2)
Also if the consumer is batch consumer
http://camel.apache.org/batch-consumer.html

Then the messages has details about the ordering in the batch. Then
you can "see" if its the last message or not. Then you can use that as
logic in your on completion.



On Tue, Apr 30, 2013 at 11:57 PM, Josiah Mangiameli
<josiah.mangiameli@urjanet.com> wrote:
> Hey all,
>
> I am looking for a way in Camel to start a context on a given route (which
> could be email, sftp, ftp or files) and not stop until all files/messages
> that meet the route criteria have been processed. I have not been able to
> find any built in functionality that would do this.
> The "sendEmptyMessageWhenIdle" would not work for email jobs and
> "OnCompletion" is triggered for every exchange that happens.
>
> My setup is very basic and is as detailed below?
>
>
>
>             context.addRoutes(new RouteBuilder() {
>                     public void configure() throws Exception{
>                         from(route).process(new FileProcessor());
>                     }
>                 });
>
>
>
>         context.start();
>         Thread.sleep(100000);
>
>         context.stop();
>
>
>
> Any help is appreciated.
> Regards,
> Josiah Mangiameli
>
>
> --
> Josiah Mangiameli
>
> Software Developer
> Urjanet Energy Solutions
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message