Spring boot 尝试处理以前在exchangeId上引发的异常时发生异常
我有这样的sftp表达式:Spring boot 尝试处理以前在exchangeId上引发的异常时发生异常,spring-boot,apache-camel,Spring Boot,Apache Camel,我有这样的sftp表达式: "sftp://" + hostName + ":22" + mainPath + subPath + "?username=" + username + "&password=" + pas
"sftp://" +
hostName +
":22" +
mainPath +
subPath +
"?username=" + username +
"&password=" + password +
fileSecondPrefix +
"&autoCreate=false" +//AYLIK_BELGE_MUTABAKAT_20200706.txt
"&strictHostKeyChecking=no" +
"&preferredAuthentications=publickey,password" +
"&disconnect=true" +
"&connectTimeout=50000" +
"&timeout=50000" +
"&noop=true" +
"&maximumReconnectAttempts=2" +
"&fastExistsCheck=true" +
"&ignoreFileNotFoundOrPermissionError=false" +
"&throwExceptionOnConnectFailed=true" +
"&localWorkDirectory=" + "/temp" +
"&consumer.bridgeErrorHandler=true"
nException(Exception.class)
.process(reconciliationExceptionProcessor)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "reconciliationExceptionProcessor")
.handled(true)
// .maximumRedeliveries(5).redeliveryDelay(10000L)
.to(SEND_MAIL_FOR_FAILED)
.end();
from(DOCUMENT_RECONCILIATION_ROUTE_START)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Camel route started")
.routeId("reconciliationCamelRoute")
.process(createFTPExpressionProcessor)
// .to(PREPARE_MAIL_FOR_FAILEDS)//todo
.to(GET_FILE_FROM_SFTP)//todo
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Camel route ended")
// .end()
;
from(GET_FILE_FROM_SFTP)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Getting the file from SFTP")
.pollEnrich()
.simple("${exchangeProperty.sftpExpression}")
//.timeout(0)
.to(SAVE_RECEIVED_IDS)
.end();
DocumentReconciliationRoute ReconciliationExceptionProcessor Exception occurred:
Message : Cannot connect to sftp://xxx
[org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:146), org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:203), org.apache.camel.component.file.remote.RemoteFileConsumer.recoverableConnectIfNecessary(RemoteFileConsumer.java:183), org.apache.camel.component.file.remote.RemoteFileConsumer.prePollCheck(RemoteFileConsumer.java:59), org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119), org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175), org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308), java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180), java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624), java.lang.Thread.run(Thread.java:748)]
, Cause Message: com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused (Connection refused)
reconciliationExceptionProcessor appName=maf-integration-offline-services podName=maf-integration-offline-services-842-2bvfx
Exception occurred while trying to handle previously thrown exception on exchangeId: ID-maf-integration-offline-services-842-2bvfx-41923-1598693278891-0-787 using: [Pipeline[[Channel[DelegateSync[com.avivasa.maf.route.offline.reconciliation.processor.ReconciliationExceptionProcessor@445f6f73]], Channel[Log(DocumentReconciliationRoute)[reconciliationExceptionProcessor]], Channel[sendTo(direct://DocumentReconciliationRoute.sendMailForFailed)]]]]. The previous and the new exception will be logged in the following. appName=maf-integration-offline-services podName=maf-integration-offline-services-842-2bvfx
我有一条这样的路线:
"sftp://" +
hostName +
":22" +
mainPath +
subPath +
"?username=" + username +
"&password=" + password +
fileSecondPrefix +
"&autoCreate=false" +//AYLIK_BELGE_MUTABAKAT_20200706.txt
"&strictHostKeyChecking=no" +
"&preferredAuthentications=publickey,password" +
"&disconnect=true" +
"&connectTimeout=50000" +
"&timeout=50000" +
"&noop=true" +
"&maximumReconnectAttempts=2" +
"&fastExistsCheck=true" +
"&ignoreFileNotFoundOrPermissionError=false" +
"&throwExceptionOnConnectFailed=true" +
"&localWorkDirectory=" + "/temp" +
"&consumer.bridgeErrorHandler=true"
nException(Exception.class)
.process(reconciliationExceptionProcessor)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "reconciliationExceptionProcessor")
.handled(true)
// .maximumRedeliveries(5).redeliveryDelay(10000L)
.to(SEND_MAIL_FOR_FAILED)
.end();
from(DOCUMENT_RECONCILIATION_ROUTE_START)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Camel route started")
.routeId("reconciliationCamelRoute")
.process(createFTPExpressionProcessor)
// .to(PREPARE_MAIL_FOR_FAILEDS)//todo
.to(GET_FILE_FROM_SFTP)//todo
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Camel route ended")
// .end()
;
from(GET_FILE_FROM_SFTP)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Getting the file from SFTP")
.pollEnrich()
.simple("${exchangeProperty.sftpExpression}")
//.timeout(0)
.to(SAVE_RECEIVED_IDS)
.end();
DocumentReconciliationRoute ReconciliationExceptionProcessor Exception occurred:
Message : Cannot connect to sftp://xxx
[org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:146), org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:203), org.apache.camel.component.file.remote.RemoteFileConsumer.recoverableConnectIfNecessary(RemoteFileConsumer.java:183), org.apache.camel.component.file.remote.RemoteFileConsumer.prePollCheck(RemoteFileConsumer.java:59), org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119), org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175), org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308), java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180), java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624), java.lang.Thread.run(Thread.java:748)]
, Cause Message: com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused (Connection refused)
reconciliationExceptionProcessor appName=maf-integration-offline-services podName=maf-integration-offline-services-842-2bvfx
Exception occurred while trying to handle previously thrown exception on exchangeId: ID-maf-integration-offline-services-842-2bvfx-41923-1598693278891-0-787 using: [Pipeline[[Channel[DelegateSync[com.avivasa.maf.route.offline.reconciliation.processor.ReconciliationExceptionProcessor@445f6f73]], Channel[Log(DocumentReconciliationRoute)[reconciliationExceptionProcessor]], Channel[sendTo(direct://DocumentReconciliationRoute.sendMailForFailed)]]]]. The previous and the new exception will be logged in the following. appName=maf-integration-offline-services podName=maf-integration-offline-services-842-2bvfx
当它无法连接或找不到文件时,应转到“异常”,然后转到“邮件发送路线”,因为:
nException(Exception.class)
.process(reconciliationExceptionProcessor)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "reconciliationExceptionProcessor")
.handled(true)
// .maximumRedeliveries(5).redeliveryDelay(10000L)
.to(SEND_MAIL_FOR_FAILED)
.end();
但是日志是这样的:
"sftp://" +
hostName +
":22" +
mainPath +
subPath +
"?username=" + username +
"&password=" + password +
fileSecondPrefix +
"&autoCreate=false" +//AYLIK_BELGE_MUTABAKAT_20200706.txt
"&strictHostKeyChecking=no" +
"&preferredAuthentications=publickey,password" +
"&disconnect=true" +
"&connectTimeout=50000" +
"&timeout=50000" +
"&noop=true" +
"&maximumReconnectAttempts=2" +
"&fastExistsCheck=true" +
"&ignoreFileNotFoundOrPermissionError=false" +
"&throwExceptionOnConnectFailed=true" +
"&localWorkDirectory=" + "/temp" +
"&consumer.bridgeErrorHandler=true"
nException(Exception.class)
.process(reconciliationExceptionProcessor)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "reconciliationExceptionProcessor")
.handled(true)
// .maximumRedeliveries(5).redeliveryDelay(10000L)
.to(SEND_MAIL_FOR_FAILED)
.end();
from(DOCUMENT_RECONCILIATION_ROUTE_START)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Camel route started")
.routeId("reconciliationCamelRoute")
.process(createFTPExpressionProcessor)
// .to(PREPARE_MAIL_FOR_FAILEDS)//todo
.to(GET_FILE_FROM_SFTP)//todo
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Camel route ended")
// .end()
;
from(GET_FILE_FROM_SFTP)
.log(LoggingLevel.INFO, DOCUMENT_RECONCILIATION_ROUTE, "Getting the file from SFTP")
.pollEnrich()
.simple("${exchangeProperty.sftpExpression}")
//.timeout(0)
.to(SAVE_RECEIVED_IDS)
.end();
DocumentReconciliationRoute ReconciliationExceptionProcessor Exception occurred:
Message : Cannot connect to sftp://xxx
[org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:146), org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:203), org.apache.camel.component.file.remote.RemoteFileConsumer.recoverableConnectIfNecessary(RemoteFileConsumer.java:183), org.apache.camel.component.file.remote.RemoteFileConsumer.prePollCheck(RemoteFileConsumer.java:59), org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:119), org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175), org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511), java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308), java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180), java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624), java.lang.Thread.run(Thread.java:748)]
, Cause Message: com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused (Connection refused)
reconciliationExceptionProcessor appName=maf-integration-offline-services podName=maf-integration-offline-services-842-2bvfx
Exception occurred while trying to handle previously thrown exception on exchangeId: ID-maf-integration-offline-services-842-2bvfx-41923-1598693278891-0-787 using: [Pipeline[[Channel[DelegateSync[com.avivasa.maf.route.offline.reconciliation.processor.ReconciliationExceptionProcessor@445f6f73]], Channel[Log(DocumentReconciliationRoute)[reconciliationExceptionProcessor]], Channel[sendTo(direct://DocumentReconciliationRoute.sendMailForFailed)]]]]. The previous and the new exception will be logged in the following. appName=maf-integration-offline-services podName=maf-integration-offline-services-842-2bvfx
在异常之前,它等待了太长时间才抛出异常Timeout=0是否为真?若我这样做,它将转到下一个路径,文件从exchange变为空,所以它会抛出异常,因为它找不到文件。哪个好