Reputation: 15
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.
Upvotes: 1
Views: 395
Reputation: 3349
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 the acquireExclusiveReadLock()
method to throw an exception when its super returns false.
Upvotes: 3