我使用的是Apache骆驼2.21.1版本,但pollEnrich遇到问题 从ftp下载特定文件。看起来当我使用花粉下载2个文件并且操作花费几分钟(4分钟)时,骆驼在移动.done目录中的第一个文件时出错。 我有这个例外:
`WARN o.a.camel.component.file.GenericFileOnCompletion - Error during commit. Exchange[ID-XXX16563-1529920620474-0-8]. Caused by: [org.apache.camel.component.file.GenericFileOperationFailedException - File operation failed: 250 CWD command successful.
Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error. Code: 250]
org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 250 CWD command successful.
Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error. Code: 250
at org.apache.camel.component.file.remote.FtpOperations.buildDirectory(FtpOperations.java:352)
at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:106)
at org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:111)
at org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:127)
at org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:83)
at org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:57)
at org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:104)
at org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:243)
at org.apache.camel.util.UnitOfWorkHelper.doneUow(UnitOfWorkHelper.java:65)
at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:685)
at org.apache.camel.processor.CamelInternalProcessor$UnitOfWorkProcessorAdvice.after(CamelInternalProcessor.java:634)
at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:251)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:127)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
at org.apache.camel.component.aws.sqs.SqsConsumer.processBatch(SqsConsumer.java:206)
at org.apache.camel.component.aws.sqs.SqsConsumer.poll(SqsConsumer.java:111)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error
at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1541)
at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1553)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at org.apache.commons.net.ftp.FTP.__send(FTP.java:545)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:519)
at org.apache.commons.net.ftp.FTPSClient.sendCommand(FTPSClient.java:568)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:648)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:622)
at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1495)
at org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:2738)
at org.apache.camel.component.file.remote.FtpOperations.buildDirectory(FtpOperations.java:329)
... 24 common frames omitted
Caused by: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1906)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1870)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1815)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:128)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.io.BufferedWriter.flush(BufferedWriter.java:254)
at org.apache.commons.net.ftp.FTP.__send(FTP.java:545)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:519)
at org.apache.commons.net.ftp.FTPSClient.sendCommand(FTPSClient.java:568)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:648)
at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:622)
at org.apache.commons.net.ftp.FTP.pwd(FTP.java:1495)
at org.apache.commons.net.ftp.FTPClient.printWorkingDirectory(FTPClient.java:2738)
at org.apache.camel.component.file.remote.FtpOperations.getCurrentDirectory(FtpOperations.java:821)
at org.apache.camel.component.file.remote.FtpOperations.deleteFile(FtpOperations.java:286)
at org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:100)
... 23 common frames omitted
Caused by: java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:876)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:847)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
... 39 common frames omitted`.
这是我的路线:
from(queueSource)
.errorHandler(deadLetterChannel("direct:dead")
.useOriginalMessage()
.maximumRedeliveries(3)
.redeliveryDelay(180000)
.retryAttemptedLogLevel(LoggingLevel.WARN)
)
.unmarshal().json(JsonLibrary.Jackson,MyClass.class)
.process(setHeaderWithMyVariableProcessorClass)
.choice()
.when(header("DownloadFilename").isEqualTo(true))
.pollEnrich()
.simple("{{ftp.path}}
&useList=false
&consumer.bridgeErrorHandler=true
&autoCreate=false
&username={{ftp.username}}&password={{ftp.password}}
&passiveMode=true
&localWorkDirectory={{ftp.localWorkDirectory}}
&maxMessagesPerPoll=1
&disconnectOnBatchComplete=true
&move={{ftp.fullFileDir}}/.done
&soTimeout=600000
&fileName=${body.getFileAssetName()}")
.aggregationStrategy(new ApplyOldExchangeAggregationStrategy())
.end()
.end()
.choice()
.when(header("DownloadAttach0").isEqualTo(true))
.pollEnrich()
.simple("{{ftp.attachmentspath}}&.....&soTimeout=600000&fileName=${body.getAttachmentList()[0]}")
.aggregationStrategy(new ApplyOldExchangeAggregationStrategy())
.end()
.end()
.log("<<<<<< ${body} >>>>>>>")
.end();