You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Babak Vahdat <ba...@swissonline.ch> on 2012/01/23 12:20:16 UTC
Re: File componet start processing files
Hi,
One possible way would be to plugin a custom PollingConsumerPollStrategy [1]
of yours (see the pollStrategy option of the file component [2]) where in
your begin method you set the counter to 0 and by your commit method you
consider the value of the passed polledMessages parameter.
[1]
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/PollingConsumerPollStrategy.html
[2] http://camel.apache.org/file2
Babak
--
View this message in context: http://camel.465427.n5.nabble.com/File-componet-start-processing-files-tp5165723p5165836.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File componet start processing files
Posted by Babak Vahdat <ba...@swissonline.ch>.
As Javadoc already states that your commit callback get's invoked *after*
each successfully completed *poll* of the directory (in your case
"file:/c:/myDirectory").
That's if something goes wrong while polling, whatsoever, then that's
instead your rollback() callback which gets invoked.
Babak
--
View this message in context: http://camel.465427.n5.nabble.com/File-componet-start-processing-files-tp5165723p5166221.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File componet start processing files
Posted by mardubie <ma...@gmail.com>.
Thanks for Your response it helped me.
I made something like this:
public boolean begin(Consumer consumer, Endpoint endpoint) {
PhotoLoadProcessing.messagesCounter.set(0);
PhotoLoadProcessing.inProgress.set(true);
}
public void commit(Consumer consumer, Endpoint endpoint, int
polledMessages) {
PhotoLoadProcessing.inProgress.set(false);
}
but I need to know when commit is called ? After all messages are consumed
by first consumer in route?
--
View this message in context: http://camel.465427.n5.nabble.com/File-componet-start-processing-files-tp5165723p5166028.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File componet start processing files
Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi again,
If not already done consider subscribing to the "Camel User List" [1] as
otherwise chances are low that somebody can react on your questions at all.
And maybe through looking at [2] you can get also some inspirations about
how to do that.
[1] http://camel.apache.org/mailing-lists.html
[2]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
Babak
--
View this message in context: http://camel.465427.n5.nabble.com/File-componet-start-processing-files-tp5165723p5165867.html
Sent from the Camel - Users mailing list archive at Nabble.com.