0

My expression is like that:

sftp://hostname/path?username=username&password=password&fileName=fileName.txt&connectTimeout=10000&soTimeout=40000&timeout=40000&stepwise=false&maximumReconnectAttempts=4&autoCreate=false&strictHostKeyChecking=no&preferredAuthentications=publickey,password&disconnect=true&stepwise=false&throwExceptionOnConnectFailed=true&consumer.bridgeErrorHandler=true

I use this expression here:

  from(GET_FILE_FROM_SFTP)
            .log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Getting the file from SFTP")
            .pollEnrich()
            .simple("${exchangeProperty.sftpExpression}")
            .timeout(20000L)
            .to(SAVE_RECEIVED_IDS)
            .end();

At first execution, it could get file. But for second time when i trigger again, it waits while putting logs like this:

Known host file not configured, using user known host file: C:\Users\caner/.ssh/known_hosts

And goes next route, but because file is empty, it cant go further.

Why cant it take the file for the second time? I removed file and put again to ftp but still cant get it.

When I give file name in that expression as another filename in same directory and try, it can get file.

Is there any lock for first file that it cant get again?

msadasjwd
  • 105
  • 10

1 Answers1

1

Set option noop=true to disable moving of file after completion. You also need idempotent=false to disable idempotency.

See SFTP Component

noop

If true, the file is not moved or deleted in any way. This option is good for readonly data, or for ETL type requirements. If noop=true, Camel will set idempotent=true as well, to avoid consuming the same files over and over again.

idemponent

Option to use the Idempotent Consumer EIP pattern to let Camel skip already processed files. Will by default use a memory based LRUCache that holds 1000 entries. If noop=true then idempotent will be enabled as well to avoid consuming the same files over and over again.

Bedla
  • 4,789
  • 2
  • 13
  • 27
  • I did idempotent false and run multiple. This time: `Type : org.apache.camel.component.file.GenericFileOperationFailedException, Message : Cannot retrieve file: , Cause Stack Trace: [com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1513), com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:1266), ` – msadasjwd Oct 02 '20 at 12:19