使用Apache Camel访问Ebay商户集成平台(MIP)

时间:2015-10-02 07:35:39

标签: java apache-camel ebay

我们希望用apache camel访问ebay商家集成平台(mip)。 它是一个“sftp服务器之类的”协议,它提供了一个你可以工作的目录结构。

因此,这是使用Apache Camel处理目录的一个主要示例。

但我们遇到了错误,因为mip-interface没有显示(或拥有)技术“。”和“..”目录。

任何人都可以给我一个提示

  • 如何配置apache camel,它可以处理没有“。”的目录结构。和“..”?或
  • 有没有更好的方法来使用支持海量数据操作的java工具访问ebay?

提前致谢。

09:13:15.909 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO  o.a.c.c.file.remote.SftpOperations - JSCH -> Authentications that can continue: password
09:13:15.910 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO  o.a.c.c.file.remote.SftpOperations - JSCH -> Next authentication method: password
09:13:16.174 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO  o.a.c.c.file.remote.SftpOperations - JSCH -> Authentication succeeded (password).
09:13:16.753 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] INFO  o.a.c.c.file.remote.SftpOperations - Connected to sftp://myuser@mip.ebay.com:22
09:13:16.753 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] DEBUG o.a.c.c.file.remote.SftpConsumer - Connected and logged in to: sftp://myuser@mip.ebay.com:22
09:13:19.070 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] DEBUG o.a.c.c.file.remote.SftpConsumer - Error occurred during poll directory: store/product/output/Oct-02-2015 due Cannot list directory: .. Removing 0 files marked as in-progress.
09:13:19.080 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] WARN  o.a.c.c.file.remote.SftpConsumer - Consumer Consumer[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser] failed polling endpoint: Endpoint[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot list directory: .]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot list directory: .
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:583) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:560) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:88) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119) ~[camel-core-2.15.2.jar:2.15.2]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.2.jar:2.15.2]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.2.jar:2.15.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: com.jcraft.jsch.SftpException: /store/product/output/Oct-02-2015/. is not a valid file path
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) ~[jsch-0.1.51.jar:na]
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2198) ~[jsch-0.1.51.jar:na]
    at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215) ~[jsch-0.1.51.jar:na]
    at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1565) ~[jsch-0.1.51.jar:na]
    at com.jcraft.jsch.ChannelSftp.ls(ChannelSftp.java:1526) ~[jsch-0.1.51.jar:na]
    at org.apache.camel.component.file.remote.SftpOperations.listFiles(SftpOperations.java:574) ~[camel-ftp-2.15.2.jar:2.15.2]
    ... 13 common frames omitted
09:13:34.221 [pool-2-thread-1] DEBUG o.h.e.j.c.i.DriverManagerConnectionProviderImpl - Connection pool now considered primed; min-size will be maintained
09:13:34.307 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] DEBUG o.a.c.c.file.remote.SftpConsumer - Error occurred during poll directory: store/product/output/Oct-02-2015 due Cannot change directory to: store. Removing 0 files marked as in-progress.
09:13:34.308 [Camel (camel-1) thread #0 - sftp://mip.ebay.com/store/product/output/Oct-02-2015] WARN  o.a.c.c.file.remote.SftpConsumer - Consumer Consumer[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser] failed polling endpoint: Endpoint[sftp://mip.ebay.com/store/product/output/Oct-02-2015?delay=15000&password=xxxxxx&preferredAuthentications=password&readLockMinAge=10s&recursive=true&runLoggingLevel=TRACE&username=myuser]. Will try again at next poll. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - Cannot change directory to: store]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot change directory to: store
    at org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:542) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.remote.SftpOperations.changeCurrentDirectory(SftpOperations.java:530) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.remote.SftpConsumer.doPollDirectory(SftpConsumer.java:80) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.remote.SftpConsumer.pollDirectory(SftpConsumer.java:52) ~[camel-ftp-2.15.2.jar:2.15.2]
    at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119) ~[camel-core-2.15.2.jar:2.15.2]
    at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [camel-core-2.15.2.jar:2.15.2]
    at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [camel-core-2.15.2.jar:2.15.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: com.jcraft.jsch.SftpException: 
    at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) ~[jsch-0.1.51.jar:na]
    at com.jcraft.jsch.ChannelSftp._realpath(ChannelSftp.java:2340) ~[jsch-0.1.51.jar:na]
    at com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:342) ~[jsch-0.1.51.jar:na]
    at org.apache.camel.component.file.remote.SftpOperations.doChangeDirectory(SftpOperations.java:540) ~[camel-ftp-2.15.2.jar:2.15.2]
    ... 13 common frames omitted

1 个答案:

答案 0 :(得分:0)

OMG - 找到了简单的解决方案:

设置 stepwise = false 将解决问题。

为什么呢?看了一下SftpConsumer.doPollDirectory()后,我找到了一个不错的IF-THEN-ELSE块:

    if (isStepwise()) {
        files = operations.listFiles();
    } else {
        files = operations.listFiles(dir);
    }

如果stepwise设置为false,则使用者将逐步执行每个目录级别。在这种情况下,它尝试使用" ls -al。"在文件夹中加载文件和目录。命令。