Hello,

I see two options for this (there are probably more).

You can use content enricher (see the bottom of
http://camel.apache.org/content-enricher.html ).
from("direct:start")
  .pollEnrich("file:inbox)
  .to("direct:result");

If I remember correctly the potential problem here is that the
pollEnrich will only fetch _one_ file and not all files in the
directory, which is the normal case for a file consumer endpoint.

So another way would be to have a route that starts with
from("file:inbox") and have it not start by default. Then create a
helper route that listen for JMS messages and on reception start the
first route.
Combine this with the sendEmptyMessageWhenIdle option on the file
endpoint and you can stop the first route when there are no more
files, which is when a empty poll occurs.

Best regards
Pontus Ullgren







On Mon, Jul 2, 2012 at 12:08 PM, raphael <[email protected]> wrote:
> Hi,
> I'd like to have a File consumer endpoint, but not scheduled on a polling
> mechanism.
> It would be triggered through a event driven consumer (JMS message for
> instance).
> Basically, I just want to be able to decide when my file consumer must read
> files in the directory.
>
> I've looked in the EventDrivenPollingConsumer, but it seems the FileConsumer
> is completely linked with the ScheduledPollConsumer.
>
> Any way to achieve this ?
>
> Thanks a lot.
> Raphael.
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/File-consumer-event-based-not-polling-tp5715349.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to