My route is polling from endpoint
ftp://localhost:21/folder?username=user&password=password&delay=15s&move=processed&moveFailed=error&sendEmptyMessageWhenIdle=true&passiveMode=true.
If I just add readLock=rename
, Camel will ignore troublesome file and leave it in folder.
How to implement camel behavior so that if file is still being locked by somebody after readLockTimeout
or n
attempts, Camel will not skip the file, but throw an Exception.
I guess this can be established by implementing a custom ReadLockStrategy (the interface is
GenericFileExclusiveReadLockStrategy
)You can set the custom strategy using the option
exclusiveReadLockStrategy
(see File2 component options).P.S. Maybe its best to override one of the strategies provided out of the box,
FileLockExclusiveReadLockStrategy
for instance. All you need then is to override theacquireExclusiveReadLock()
method to throw an exception when its super returns false.