You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ajayappa <an...@gmail.com> on 2007/10/01 23:26:30 UTC
How to make camel stop automaticaly
I've a program like this :
public static void main(String args[]) {
CamelContext ctx = new DefaultCamelContext();
ctx.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
from("file:src/data?noop=true").to("smtp://localhost?#xyz@abc.com");
}
ctx.start();
}
Is it possibly to make Camel stop (ie the program should end) immediately
after all the files in the folder data are processed ??
--
View this message in context: http://www.nabble.com/How-to-make-camel-stop-automaticaly-tf4551224s22882.html#a12988246
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to make camel stop automaticaly
Posted by Hiram Chirino <hi...@hiramchirino.com>.
Hi,
I just added a ?consumer.generateEmptyExchangeWhenIdle=true option..
that should be able to handle your case if you do something like:
public static void main(String args[]) throws Exception {
final CamelContext ctx = new DefaultCamelContext();
final Processor shutdown = new Processor(){
public void process(Exchange exchange) throws Exception {
ctx.stop();
}
};
ctx.addRoutes(new RouteBuilder() {
public void configure() throws Exception {
from("file:src/data?consumer.generateEmptyExchangeWhenIdle=true&noop=true")
.choice()
.when(body().isNull()).process(shutdown)
.otherwise().to("smtp://localhost?#xyz@abc.com");
}
});
ctx.start();
}
On 10/1/07, ajayappa <an...@gmail.com> wrote:
>
> I've a program like this :
>
> public static void main(String args[]) {
> CamelContext ctx = new DefaultCamelContext();
> ctx.addRoutes(new RouteBuilder() {
> public void configure() throws Exception {
> from("file:src/data?noop=true").to("smtp://localhost?#xyz@abc.com");
> }
> ctx.start();
> }
>
> Is it possibly to make Camel stop (ie the program should end) immediately
> after all the files in the folder data are processed ??
>
>
>
>
> --
> View this message in context: http://www.nabble.com/How-to-make-camel-stop-automaticaly-tf4551224s22882.html#a12988246
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Regards,
Hiram
Blog: http://hiramchirino.com