Camel FTP无法在“目录未找到”的情况下自动列出目录,并在目录前面自动附加其他“ /”

时间:2019-04-08 09:22:33

标签: apache-camel camel-ftp

我正在尝试从Windows Server轮询文件。 SFTP使用IP交换机/ WS_FTP托管。 User Permissions

我需要根据特定日期来轮询动态文件夹中的文件,因此我在端点URI中提供了父目录,启用了递归标志并相应地添加了filterDirectory。但是它无法从目录中轮询,它表示找不到该目录的文件。它在列出listFor(/XXXX)

时尝试使用加号'/'

端点URI

sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&stepwise=false&username=XXXX_ftpuser

跟踪日志

TRACE 2019-04-05T15:25:03,389 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 
TRACE 2019-04-05T15:25:03,389 [org.apache.camel.component.file.remote.SftpOperations] - listFiles()
TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - Found 12 in directory: 
TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:27 ., dir=true]
TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[.]
TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 03:04 .., dir=true]
TRACE 2019-04-05T15:25:03,712 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[..]
TRACE 2019-04-05T15:25:03,728 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20170526, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 02:16 20170526, dir=true]
TRACE 2019-04-05T15:25:04,413 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20170526]
TRACE 2019-04-05T15:25:04,413 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181119, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:24 20181119, dir=true]
TRACE 2019-04-05T15:25:05,117 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20181119]
TRACE 2019-04-05T15:25:05,117 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181121, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:25 20181121, dir=true]
TRACE 2019-04-05T15:25:05,837 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20181121]
TRACE 2019-04-05T15:25:05,840 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181122, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:26 20181122, dir=true]
TRACE 2019-04-05T15:25:06,561 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[20181122]
TRACE 2019-04-05T15:25:06,563 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181123, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:27 20181123, dir=true]
TRACE 2019-04-05T15:25:07,258 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: /20181123 from: sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&stepwise=false&username=XXXX_ftpuser
TRACE 2019-04-05T15:25:07,260 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: /20181123, dirName: 20181123
TRACE 2019-04-05T15:25:07,263 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: /20181123
TRACE 2019-04-05T15:25:07,265 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(/20181123)
DEBUG 2019-04-05T15:25:07,281 [org.apache.camel.component.file.remote.SftpConsumer] - Caught exception Cannot list directory: /20181123
TRACE 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Not ignoring file error Cannot list directory: /20181123 for /20181123
DEBUG 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Error occurred during poll directory:  due Cannot list directory: /20181123. Removing 0 files marked as in-progress.
WARN  2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.RemoteFilePollingConsumerPollStrategy] - Trying to recover by force disconnecting from remote server and re-connecting at next poll: sftp://XXX@1XXXX:22051
DEBUG 2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Force disconnecting from: sftp://XXX@XXXX:22051
WARN  2019-04-05T15:25:07,297 [org.apache.camel.component.file.remote.SftpConsumer] - Consumer SftpConsumer[sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&stepwise=false&username=XXXX_ftpuser] failed polling endpoint: sftp://XXXX:22051?connectTimeout=90000&disconnect=true&filterDirectory=%24%7Bfile%3Aname%7D+starts+with+%27%24%7Bbean%3AdateofExchange%3Fmethod%3DforLoc%28%22MY%22%29%7D%27&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&stepwise=false&username=XXXX_ftpuser. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot list directory: /20181123]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: /20181123
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:660) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:128) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    at org.apache.camel.component.file.remote.RemoteFileConsumer.doSafePollSubDirectory(RemoteFileConsumer.java:260) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    at org.apache.camel.component.file.remote.SftpConsumer.pollSubDirectory(SftpConsumer.java:96) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:178) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:87) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:124) ~[camel-core-2.21.1.jar!/:2.21.1]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.21.1.jar!/:2.21.1]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.21.1.jar!/:2.21.1]
    at org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerJob.execute(QuartzScheduledPollConsumerJob.java:61) [camel-quartz2-2.21.1.jar!/:2.21.1]
    at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.3.0.jar!/:?]
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.3.0.jar!/:?]
Caused by: com.jcraft.jsch.SftpException: File not found: /20181123
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873) ~[jsch-0.1.54.jar!/:?]
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2225) ~[jsch-0.1.54.jar!/:?]
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2242) ~[jsch-0.1.54.jar!/:?]
    at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1592) ~[jsch-0.1.54.jar!/:?]
    at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1553) ~[jsch-0.1.54.jar!/:?]
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:651) ~[camel-ftp-2.21.1.jar!/:2.21.1]
    ... 11 more

当我尝试使用endpint URI对该文件夹进行硬编码时,它只是可以列出该目录并轮询文件。这次列出listFor(XXXX)

时目录前没有'/'

端点URI

sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser

跟踪日志

TRACE 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpConsumer] - prePollCheck on sftp://XXX@XXXX:22051
DEBUG 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpConsumer] - Not connected/logged in, connecting to: sftp://XXX@XXXX:22051
TRACE 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpOperations] - Session isn't connected, trying to recreate and connect.
DEBUG 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpOperations] - Using knownhosts file: C:\program files\ascertain\I2R-MystiQ-Engine\known_hosts
DEBUG 2019-04-05T18:40:00,009 [org.apache.camel.component.file.remote.SftpOperations] - Using known hosts information from file: C:\program files\ascertain\I2R-MystiQ-Engine\known_hosts
DEBUG 2019-04-05T18:40:00,025 [org.apache.camel.component.file.remote.SftpOperations] - Using StrickHostKeyChecking: no
DEBUG 2019-04-05T18:40:00,025 [org.apache.camel.component.file.remote.SftpOperations] - Using PreferredAuthentications: password
TRACE 2019-04-05T18:40:00,025 [org.apache.camel.component.file.remote.SftpOperations] - Connecting use connectTimeout: 90000 ...
TRACE 2019-04-05T18:40:00,465 [org.apache.camel.component.file.remote.SftpOperations] - Channel isn't connected, trying to recreate and connect.
TRACE 2019-04-05T18:40:00,465 [org.apache.camel.component.file.remote.SftpOperations] - Connecting use connectTimeout: 90000 ...
DEBUG 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpOperations] - Connected to sftp://XXX@XXXX:22051
DEBUG 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpConsumer] - Connected and logged in to: sftp://XXX@XXXX:22051
TRACE 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123, dirName: null
TRACE 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123
TRACE 2019-04-05T18:40:01,215 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123)
TRACE 2019-04-05T18:40:02,621 [org.apache.camel.component.file.remote.SftpConsumer] - Found 6 in directory: 20181123
TRACE 2019-04-05T18:40:02,621 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:27 ., dir=true]
TRACE 2019-04-05T18:40:02,621 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[.]
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:27 .., dir=true]
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[..]
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=Consolidated, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:26 Consolidated, dir=true]
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: 20181123/Consolidated from: sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123/Consolidated, dirName: Consolidated
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123/Consolidated
TRACE 2019-04-05T18:40:02,637 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123/Consolidated)
TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - Found 5 in directory: 20181123/Consolidated
TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:26 ., dir=true]
TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/.]
TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:27 .., dir=true]
TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/..]
TRACE 2019-04-05T18:40:02,715 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020438943_021420181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin   408097 Nov 23 2018 20181124020438943_021420181123INW.MYR, dir=false]
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/20181124020438943_021420181123INW.MYR]
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020439099_035820181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin    21689 Nov 23 2018 20181124020439099_035820181123INW.MYR, dir=false]
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/20181124020439099_035820181123INW.MYR]
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=ToPPay, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 06:41 ToPPay, dir=true]
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: 20181123/Consolidated/ToPPay from: sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123/Consolidated/ToPPay, dirName: ToPPay
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123/Consolidated/ToPPay
TRACE 2019-04-05T18:40:02,731 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123/Consolidated/ToPPay)
TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - Found 8 in directory: 20181123/Consolidated/ToPPay
TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 06:41 ., dir=true]
TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/.]
TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:26 .., dir=true]
TRACE 2019-04-05T18:40:02,777 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/..]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=021420181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin   408097 Nov 23 2018 021420181123INW.MYR, dir=false]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/021420181123INW.MYR]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=021420181123INW1.MYR, longName=-r-x------ 1 ftpadmin ftpadmin   579829 Nov 23 2018 021420181123INW1.MYR, dir=false]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/021420181123INW1.MYR]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=035820181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin    21689 Nov 23 2018 035820181123INW.MYR, dir=false]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/035820181123INW.MYR]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=035820181123INW1.MYR, longName=-r-x------ 1 ftpadmin ftpadmin    30954 Nov 23 2018 035820181123INW1.MYR, dir=false]
TRACE 2019-04-05T18:40:02,793 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/035820181123INW1.MYR]
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020438943_021420181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin   408097 Nov 23 2018 20181124020438943_021420181123INW.MYR, dir=false]
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/20181124020438943_021420181123INW.MYR]
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181124020439099_035820181123INW.MYR, longName=-r-x------ 1 ftpadmin ftpadmin    21689 Nov 23 2018 20181124020439099_035820181123INW.MYR, dir=false]
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Consolidated/ToPPay/20181124020439099_035820181123INW.MYR]
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=Data, longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:26 Data, dir=true]
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - Polling sub directory: 20181123/Data from: sftp://XXXX:22051/20181123?connectTimeout=90000&disconnect=true&flatten=true&include=.*IMG&knownHostsFile=C%3A%5Cprogram+files%5Cascertain%5CI2R-MystiQ-Engine%5Cknown_hosts&noop=true&password=xxxxxx&preferredAuthentications=password&reconnectDelay=30000&recursive=true&scheduler=quartz2&scheduler.cron=0+0%2F5+*+*+*+%3F&separator=Auto&stepwise=false&username=XXXX_ftpuser
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - doPollDirectory from absolutePath: 20181123/Data, dirName: Data
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpConsumer] - Polling directory: 20181123/Data
TRACE 2019-04-05T18:40:02,809 [org.apache.camel.component.file.remote.SftpOperations] - listFiles(20181123/Data)
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - Found 501 in directory: 20181123/Data
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:26 ., dir=true]
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Data/.]
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=.., longName=dr-x------ 2 ftpadmin ftpadmin        0 Mar 12 05:27 .., dir=true]
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Data/..]
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - SftpFile[fileName=20181123021401015101004323IWNM.MMYR, longName=-r-x------ 1 ftpadmin ftpadmin    14846 Nov 23 2018 20181123021401015101004323IWNM.MMYR, dir=false]
TRACE 2019-04-05T18:40:02,871 [org.apache.camel.component.file.remote.SftpConsumer] - File did not match. Will skip this file: RemoteFile[Data/20181123021401015101004323IWNM.MMYR] 

我确定问题的原因必须是在列出listFor(/XXXX)时,在目录名前加上'/'。我该如何避免! ..使用seperator参数没有效果,我想它仅用于生成文件而不用于消费。我需要尽快解决此问题。请给我建议一些解决方案:(

已编辑:

我也可以重现最新版本的问题,我想问题是当没有基本路径时,只有'/'被添加了,而这实际上并不会发生

SftpConsumer.java Camel 3.0.0.M1中的

代码段

if (file.isDirectory()) {
                RemoteFile<SftpRemoteFile> remote = asRemoteFile(absolutePath, file, getEndpoint().getCharset());
                if (endpoint.isRecursive() && depth < endpoint.getMaxDepth() && isValidFile(remote, true, files)) {
                    // recursive scan and add the sub files and folders
                    String subDirectory = file.getFilename();
                    String path = absolutePath + "/" + subDirectory;
                    boolean canPollMore = pollSubDirectory(path, subDirectory, fileList, depth);
                    if (!canPollMore) {
                        return false;
                    }
                }
                // we cannot use file.getAttrs().isLink on Windows, so we dont invoke the method
                // just assuming its a file we should poll
            }
  

字符串路径= absolutePath +“ /” +子目录;

0 个答案:

没有答案