java - camel handle exception when SFTP server is not available -


camel version 2.16.1

we have created sftp consumer route follows:

from("sftp://fakeuser@fakehost:22" +       "/?password=fakepassword" +       "&pollstrategy=#pollstrategy" +       "&recursive=true" +       "&throwexceptiononconnectfailed=true" +       "&delete=true" +       "&consumer.bridgeerrorhandler=true" +       "&maximumreconnectattempts=3")  .onexception(exception.class).handled(true)       .to("log:errorlog?level=error&showall=true&multiline=true")       .setheader("any_message", constant("error occured!"))       .handled(true)  .end()  .to((new file("c:/temp")).touri().tostring());  

how configure route handle exception thrown when sftp host not available?. route cannot reach onexception section though consumer.bridgeerrorhandler=true , throwexceptiononconnectfailed=true , have custom made proxy. custom made proxy never used because of throwexceptiononconnectfailed=true. looks consumer.bridgeerrorhandler not intended.

the log file instead has produced following stack trace:

org.apache.camel.component.file.genericfileoperationfailedexception: cannot connect sftp://fakeuser@fakehost:22          @ 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:171)          @ org.apache.camel.component.file.remote.remotefileconsumer.prepollcheck(remotefileconsumer.java:59)          @ org.apache.camel.component.file.genericfileconsumer.poll(genericfileconsumer.java:106)          @ org.apache.camel.impl.scheduledpollconsumer.dorun(scheduledpollconsumer.java:174)          @ org.apache.camel.impl.scheduledpollconsumer.run(scheduledpollconsumer.java:101)          @ java.util.concurrent.executors$runnableadapter.call(unknown source)          @ java.util.concurrent.futuretask.runandreset(unknown source)          @ java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.access$301(unknown source)          @ java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.run(unknown source)          @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)          @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)          @ java.lang.thread.run(unknown source)  caused by: com.jcraft.jsch.jschexception: java.net.unknownhostexception: fakehost          @ com.jcraft.jsch.util.createsocket(util.java:394)          @ com.jcraft.jsch.session.connect(session.java:215)          @ org.apache.camel.component.file.remote.sftpoperations.connect(sftpoperations.java:118)          ... 13 common frames omitted  caused by: java.net.unknownhostexception: fakehost          @ java.net.abstractplainsocketimpl.connect(unknown source)          @ java.net.plainsocketimpl.connect(unknown source)          @ java.net.sockssocketimpl.connect(unknown source)          @ java.net.socket.connect(unknown source)          @ java.net.socket.connect(unknown source)          @ java.net.socket.<init>(unknown source)          @ java.net.socket.<init>(unknown source)          @ com.jcraft.jsch.util$1.run(util.java:362)          ... 1 common frames omitted  


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -