camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From christoffer <christof...@k15t.com>
Subject Re: Consume files periodically or on demand
Date Wed, 09 Oct 2013 20:09:05 GMT
Hi,

thank you very much for your great input.
I tried using the approach with pollEnrich - but that only consumes one file
from the (potentially) many files.

I figured out the following approach using pollEnrich 
from(demandFileConsumption).pollEnrich(fileEndpointName +
"?sendEmptyMessageWhenIdle=true").choice()
.when(body().isNull()).stop()
.otherwise().wireTap(demandFileConsumption, false,
constant("trigger")).to("mock:result").endChoice();

demandFileConsumption is direct endpoint URI and fileEndpointName is a file
endpoint URI. When I send a message to demandFileConsumption, this will
consume the first file, which in turn trigger the consumption of the next
file via the wireTap. If the source directory is drained of files the
content based router shuts down the polling for files.
This seems to work; is there a cleaner or more "camelish" approach. I think
using the approach would basically be the same idea.
Thanks for your input and keep ridin', chris




--
View this message in context: http://camel.465427.n5.nabble.com/Consume-files-periodically-or-on-demand-tp5741235p5741247.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message