我使用的是apache驼峰版 2.10.0
我在SFTP使用者中使用 disconnect = true 。这绝对没问题。然而,有时消费者变得完全闲置。重新部署消费者后,它再次开始轮询。我将轮询间隔设置为10秒。这是我的完整路线配置。 路线/终点
<ftp:binding.sftp xmlns:ftp="urn:switchyard-component-camel-ftp:config:1.1" name="i014-SFTP-Central-abcbank-Local">
<ftp:contextMapper class="com.hm.goep.esb.composer.SI_InContextMapper"/>
<ftp:additionalUriParameters>
<ftp:parameter name="recursive" value="${goep.hm.abcbank.ftp_recursive}"/>
<ftp:parameter name="antInclude" value="*.csv"/>
<ftp:parameter name="consumer.bridgeErrorHandler" value="true"/>
<ftp:parameter name="localWorkDirectory" value="${goep.hm.esb-sap.in.filedirectory}/i014/"/>
<ftp:parameter name="passiveMode" value="${goep.hm.abcbank.ftp_passive_mode}"/>
<ftp:parameter name="binary" value="true"/>
</ftp:additionalUriParameters>
<ftp:directory>${goep.hm.i014.abcbank.ftpdirectory}</ftp:directory>
<ftp:autoCreate>false</ftp:autoCreate>
<ftp:host>${goep.hm.abcbank.ftp_server}</ftp:host>
<ftp:port>${goep.hm.abcbank.ftp_port}</ftp:port>
<ftp:username>${goep.hm.abcbank.ftp_user}</ftp:username>
<ftp:password>${goep.hm.abcbank.ftp_password}</ftp:password>
<ftp:binary>true</ftp:binary>
<ftp:disconnect>true</ftp:disconnect>
<ftp:stepwise>false</ftp:stepwise>
<ftp:throwExceptionOnConnectFailed>true</ftp:throwExceptionOnConnectFailed>
<ftp:consume>
<ftp:delete>true</ftp:delete>
<ftp:sortBy>file:modified</ftp:sortBy>
<ftp:readLock>changed</ftp:readLock>
<ftp:startingDirectoryMustExist>true</ftp:startingDirectoryMustExist>
<ftp:directoryMustExist>true</ftp:directoryMustExist>
<ftp:delay>${goep.hm.i014.abcbank.inbound.poll_interval}</ftp:delay>
</ftp:consume>
线程转储
"Connect thread 110.75.144.86 session" daemon prio=10 tid=0x00007f7450012000 nid=0x1800 runnable [0x00007f7518408000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at com.jcraft.jsch.IO.getByte(IO.java:82)
at com.jcraft.jsch.Session.read(Session.java:885)
at com.jcraft.jsch.Session.run(Session.java:1289)
at java.lang.Thread.run(Thread.java:745)
"Camel (camel-101) thread #124 - sftp://testuser:******@11.11.11.11:22/download" daemon prio=10 tid=0x00007f748c090800 nid=0x7b46 in Object.wait() [0x00007f74cd35e000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000730625758> (a com.jcraft.jsch.Channel$MyPipedInputStream)
at java.io.PipedInputStream.read(PipedInputStream.java:327)
- locked <0x0000000730625758> (a com.jcraft.jsch.Channel$MyPipedInputStream)
at java.io.PipedInputStream.read(PipedInputStream.java:378)
- locked <0x0000000730625758> (a com.jcraft.jsch.Channel$MyPipedInputStream)
at com.jcraft.jsch.ChannelSftp._get(ChannelSftp.java:1041)
at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:944)
at com.jcraft.jsch.ChannelSftp.get(ChannelSftp.java:922)
at org.apache.camel.component.file.remote.SftpOperations.retrieveFileToFileInLocalWorkDirectory(SftpOperations.java:675)
at org.apache.camel.component.file.remote.SftpOperations.retrieveFile(SftpOperations.java:542)
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:317)
at org.apache.camel.component.file.remote.RemoteFileConsumer.processExchange(RemoteFileConsumer.java:92)
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
在每次轮询期间,消费者首先连接到服务器,然后断开与服务器的连接。但在上次轮询期间,消费者连接到SFTP服务器,但没有断开连接然后闲置。
投票期间的常用日志:
02-05-2016 20:48:36,662 INFO (org.apache.camel.component.file.remote.SftpOperations) [Camel (camel-99) thread #117 - sftp://xxxx:******@11.11.11.11:22/download] Connected to sftp://xxxx:******@11.11.11.11:22
02-05-2016 20:48:36,662 INFO (org.apache.camel.component.file.remote.SftpConsumer) [Camel (camel-99) thread #117 - sftp://xxxx:******@11.11.11.11:22/download] Connected and logged in to: sftp://xxxx:******@11.11.11.11:22
02-05-2016 20:48:38,539 INFO (org.apache.camel.component.file.remote.SftpOperations) [Camel (camel-99) thread #117 - sftp://xxxx:******@11.11.11.11:22/download] JSCH -> Disconnecting from 11.11.11.11 port 22
消费者停止投票后的错误日志:
02-05-2016 20:59:39,392 INFO (org.apache.camel.component.file.remote.SftpOperations) [Camel (camel-99) thread #117 - sftp://xxxx:******@11.11.11.11:22/download] Connected to sftp://xxxx:******@11.11.11.11:22
02-05-2016 20:59:39,392 INFO (org.apache.camel.component.file.remote.SftpConsumer) [Camel (camel-99) thread #117 - sftp://xxxx:******@11.11.11.11:22/download] Connected and logged in to: sftp://xxxx:******@11.11.11.11:22
请建议在这里可以做些什么。