Hello,

I'm using Apache Camel version 2.24.2.

I a Camel route that is processing files located an sFTP server. There are 
multiple nodes running the application where the route is located, so I have 
added file locking in an attempt to ensure only a single node process each file.

The route URI looks like this:
sftp://<user>@<server>:<port>/<folder>?password=<password>&readLock=changed&readLockMinAge=10s&delete=true&delay=60s&include=<file
 mask>

The route looks like this:
from(inUri).id("myId")
  .idempotentConsumer(header(Exchange.FILE_NAME), 
messageIdRepository).eager(true).skipDuplicate(true)
  .log(LoggingLevel.INFO, "Processing file:  ${file:name}")
  // Save original file in archive directory.
  .to(archiveUri)
  ... do other stuff...

Every now and then, I'm getting what looks like file contention warning 
messages:

Error processing file RemoteFile[<file>] due to
  Cannot retrieve file: <file>. Caused by: 
[org.apache.camel.component.file.GenericFileOperationFailedException - Cannot 
retrieve file: <file>]
  org.apache.camel.component.file.GenericFileOperationFailedException: Cannot 
retrieve file: <file>
    Caused by: com.jcraft.jsch.SftpException: No such file

... and also these:

Error during commit. Caused by: 
[org.apache.camel.component.file.GenericFileOperationFailedException - Cannot 
delete file: <file>]
  org.apache.camel.component.file.GenericFileOperationFailedException: Cannot 
delete file: <file>
    Caused by: com.jcraft.jsch.SftpException: No such file

Have I missed anything in my setup?

I've also tried adding the idempotent repository to the input URI, like this:
sftp://<user>@<server>:<port>/<folder>?password=<password>&readLock=changed&readLockMinAge=<minAge>&delete=true&delay=<delay>&include=<file
 
mask>&idempotent=true&idempotentKey=$simple{file:name}&idempotentRepository=#messageIdRepository

... but am getting the same kind of errors.

Thanks for any assistance,

Mark

Reply via email to