Идемпотентная конечная точка верблюжьего SFTP с несколькими узлами, все еще генерирующими исключения? - PullRequest
0 голосов
/ 04 апреля 2019

Мы внедрили конечную точку Camel SFTP, которая работает в системе с несколькими узлами.Чтобы предотвратить повторное получение сообщения, мы добавили JdbcMessageIdRepository.В целом это работает нормально, но мы не можем избавиться от некоторых исключений GenericFileOperationFailedExceptions, в данном случае, потому что к узлам, желающим переместить один и тот же файл.Есть ли что-то, что мы делаем неправильно в нашей настройке, или это поведение по умолчанию конечной точки SFTP с реализацией idempotentRepository?Если мы удалим свойство 'preMove', мы получим уникальные нарушения ограничений в JdbcMessageIdRepository, так что каким-то образом этот механизм, по-видимому, действительно не гарантирует, что ни одно дублирующее сообщение не будет получено?

Конфигурация нашей конечной точки:

private String createCamelUrl() {
    return createBaseUrl()
            + "?include=" + includePattern
            + "&preMove=../work"
            + "&move=../history"
            + "&maxDepth=1"
            + "&maxMessagesPerPoll=10"
            + "&readLock=idempotent"
            + "&idempotent=true"
            + "&idempotentKey=${file:name}"
            + "&idempotentRepository=#" + idempotentRepository
            + "&inProgressRepository=#" + idempotentRepository
            + "&privateKeyFile=" + privateKeyFile
            + "&privateKeyFilePassphrase=" + privateKeyFilePassphrase;
}

Stacktrace, иногда встречающийся:

2019-04-04 06:45:01,655 WARN  | sb/export/outbox | o.a.c.component.file.remote.SftpConsumer | sftp://user@server:port/../../outbox?idempotent=true&idempotentKey=%24%7Bfile%3Aname%7D&idempotentRepository=%23%23jdbcMessageIdRepository&inProgressRepository=%23%23jdbcMessageIdRepository&include=.*%5C.txt&maxDepth=1&maxMessagesPerPoll=10&move=..%2Fhistory&preMove=..%2Fwork&privateKeyFile=%2Fhome%2Fsomething%2F.ssh%2Fid_rsa&privateKeyFilePassphrase=xxxxxx&readLock=idempotent cannot begin processing file: RemoteFile[1554353101529.txt] due to: Cannot rename file from: ../../outbox/1554353101529.txt to: ../../work/1554353101529.txt. Caused by: 
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file from: ../../outbox/1554353101529.txt to: ../../work/1554353101529.txt
        at org.apache.camel.component.file.remote.SftpOperations.renameFile(SftpOperations.java:499)
        at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:128)
        at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin(GenericFileRenameProcessStrategy.java:45)
        at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:362)
        at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:133)
        at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:223)
        at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:187)
        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.jcraft.jsch.SftpException: No such file
        at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
        at com.jcraft.jsch.ChannelSftp.rename(ChannelSftp.java:1950)
        at org.apache.camel.component.file.remote.SftpOperations.renameFile(SftpOperations.java:495)
        ... 15 common frames omitted
...