I recently started playing with Apache camel. So, as an experimental type, I thought I would create a simple project that would check the file directory every couple of seconds to see if I have a new file that picks up this file and then copies it to another folder. Later I want to put these files in a database.
So, by first supporting the basics, I created a route like:
from("file://c:/CTest/inbox?noop=true") .to("file://C:/Ctest/outbox");
This worked, and I thought ok lets add a timer. I initially made a mistake when using the timer and tried this:
from("timer://myTimer?period=50").to("file://c:/CTest/inbox?noop=true") .to("file://C:/Ctest/outbox");
I then had a strange exception due to the inability to write a file. Then I realized that by placing the file route after the timer route, he became a producer. So I did a little research, and here I am a little confused.
So, from my understanding, the file component uses a scheduled poll template. There is even the pollStrategy option in the file URL pattern. There is also a consumer EIP survey.
So this is where my confusion comes in.
1) If the file component uses the scheduled survey template, does it use / implement the EIP questionnaire?
2) How to add a simple schedule to the file component to use files every 30 seconds?
3) How to create your own pollingStrategy function by executing org.apache.camel.PollingConsumerPollStrategy?
I suspect I can do something like this:
from("file://c:/CTest/inbox?noop=true&pollStrategy=some-expression") .to("file://C:/Ctest/outbox");
I tried to give a few examples around this, but I either do not look at the right places, or the plot is not enough completely. I guess this is not so much a code related issue as a more appropriate strategy / template for this approach.
Thanks Namphibian