I had tried this option it does not result in file being processed based on
timestamp. 

readLock=changed 

I believe this attribute is used to to check if the file can be locked or
not depending on last modified timestamp.

Changed file were processed automatically in Camel 1.x, once I upgraded to
2.x it stopped working, therefore I decided to provide the implementation of 
IdempotentRepository 



Claus Ibsen-2 wrote:
> 
> Hi
> 
> Have you tried the readLock=changed option?
> http://camel.apache.org/file2.html
> 
> 
> On Thu, Jan 28, 2010 at 4:01 PM, vjintegrates <vijaypawnar...@gmail.com>
> wrote:
>>
>> I have added following implementation of IdempotentRepository to process
>> a
>> specific file from directory  when the file is modified. This is using
>> Camel
>> 2.x, Is there an alternative approach ?
>>
>> <from
>> uri="file:src/data?noop=true&amp;idempotentRepository=#fileChanged&amp;delay=300000&amp;fileName=myfile.txt"/>
>>
>> <bean id="fileChanged" class="mypkg.FileChangedRepository">
>>        <property name="fileDir" value="src/data" />
>> </bean>
>>
>> public class FileChangedRepository implements
>> IdempotentRepository<String>{
>>
>>        private String fileDir;
>>        private long lastModified =0;
>>
>>       �...@override
>>        public boolean add(String arg0) {
>>                return false;
>>        }
>>
>>       �...@override
>>        public boolean confirm(String arg0) {
>>                return true;
>>        }
>>
>>       �...@override
>>        public boolean contains(String arg0) {
>>                synchronized(this) {
>>                File file = new File(fileDir + File.separator + arg0);
>>
>>                if (file.lastModified() > lastModified) {
>>                        lastModified = file.lastModified();
>>                        return false;
>>                }
>>                return true;
>>               }
>>        }
>>
>>       �...@override
>>        public boolean remove(String arg0) {
>>                return false;
>>        }
>>
>>        public void setFileDir(String fileDir) {
>>                this.fileDir = fileDir;
>>        }
>>
>>        public String getFileDir() {
>>                return fileDir;
>>        }
>> }
>> --
>> View this message in context:
>> http://old.nabble.com/Identifying-and-processing-changed-file-when-noop%3Dtrue-tp27357357p27357357.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Identifying-and-processing-changed-file-when-noop%3Dtrue-tp27357357p27381562.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to