You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dunnlow <du...@yahoo.com> on 2012/03/20 17:17:09 UTC

Best way to timeout file consumer?

Hi,  I'm using camel 2.9 and spring DSL

I'm consuming files from a directory, which normally works great.  The
problem is that the directory is a network mount and sometimes it gets into
an odd state where it exists but can not be read (e.g. I can 'cd' to the
directory, but a directory listing 'ls' just hangs).  The result is that the
file consumer freezes.  

My vision is to know when this error condition exists and be notified (I
have a notification route that sends information in the exchange to me via
email).  

A few important details: 

- A challenge that I have is that I can not intentionally duplicate this
error state, so I will be unable to really test my solution...until the
problem happens again :(  Thus, I am looking for a 'robust' solution.

- The files are placed in that directory intermittently by external
applications.  However, no more than 10 mins should go by without finding a
file there.

One consideration is to trigger an error if 10 mins or so has gone by since
I've read a file from that location.  Although I'm not exactly sure how to
implement that at the moment it seems doable.  (Maybe use
sendEmptyMessageWhenIdle and multicast to a polling consumer?)  But, I'm not
convinced this wont hang.

Another (better?) solution I am considering is to create a timer that tries
to create a file (and .done) at that location, then a consumer to consume it
and wrap the whole thing in an exception handler.  My thought (pure hunch)
is that a producer is more likely to fail.

I've considered using the startingDirectoryMustExist on the file consumer,
but as I mentioned, the directory DOES exist, but it hangs for example if
you try to get a directory listing (e.g  via 'ls') so I'm not convinced that
will work.

I'm also considering implementing my own consumer processing
(PollingConsumerPollStrategy).

What is the smart/standard way to handle this problem?

Thanks for any thoughts!  
-J



--
View this message in context: http://camel.465427.n5.nabble.com/Best-way-to-timeout-file-consumer-tp5580492p5580492.html
Sent from the Camel - Users mailing list archive at Nabble.com.