camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Question regarding File Component
Date Tue, 09 Aug 2011 10:21:41 GMT
On Tue, Aug 9, 2011 at 12:10 PM, shekher awasthi
<> wrote:
> Hi,
> After going through what all was available about File component ,i still
> have one query regarding the working of this component
> i have configured route something like this
> from("file:data/csv?fileName=input-customer3.csv").to("file:data/csvoutput")
> since i have specified specific file name in side the csv directory and as
> per my assumptions Camel file component should try to look for this exact
> file
> but what i observe is that it not showing any error/exception about the file
> name (i have intentionaly give wrong file name which does not exist) when
> the file with specified name is not there,it keep polling the location till
> i am not closing the context
> Is it a intentioanly defined way of working?

Yes that is how it works. Its a filter. So it only pickup files
matching any filter criteria you setup.

> is there any way camel can notify back that such file does not exist in the
> specified location?

You can configure a custom
org.apache.camel.spi.PollingConsumerPollStrategy on the file endpoint,
which has callbacks.

For example it will invoke the commit method with polledMessages=0 in
case there was 0 files polled.


And then you need to register your custom PollingConsumerPollStrategy
in the Registry with the bean id "myPollStrategy".

If you use a Spring XML file then its simply just

<bean id="myPollStrategy" class="com.mycompany...."/>

> Thanks in advance

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message