My camel SFTP consumer connects to server every 10 seconds and during every connect it prints huge log messages as mentioned here.
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex: client:
hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex: client:
none
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex: client:
none
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex: client:
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex: client:
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex:
server->client aes128-ctr hmac-md5 none
02-05-2016 20:48:34,441 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> kex:
client->server aes128-ctr hmac-md5 none
02-05-2016 20:48:34,443 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
SSH_MSG_KEXDH_INIT sent
02-05-2016 20:48:34,444 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> expecting
SSH_MSG_KEXDH_REPLY
02-05-2016 20:48:34,762 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
ssh_rsa_verify: signature true
02-05-2016 20:48:34,762 WARN
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> Permanently
added '11.11.11.11' (RSA) to the list of known hosts.
02-05-2016 20:48:34,763 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
SSH_MSG_NEWKEYS sent
02-05-2016 20:48:34,763 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
SSH_MSG_NEWKEYS received
02-05-2016 20:48:34,763 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
SSH_MSG_SERVICE_REQUEST sent
02-05-2016 20:48:35,079 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
SSH_MSG_SERVICE_ACCEPT received
02-05-2016 20:48:35,391 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
Authentications that can continue:
publickey,keyboard-interactive,password
02-05-2016 20:48:35,391 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> Next
authentication method: publickey
02-05-2016 20:48:35,391 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH ->
Authentications that can continue: password
02-05-2016 20:48:35,391 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> Next
authentication method: password
02-05-2016 20:48:35,707 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] JSCH -> Authentication
succeeded (password).
02-05-2016 20:48:36,662 INFO
(org.apache.camel.component.file.remote.SftpOperations) [Camel
(camel-99) thread #117 -
sftp://username:******#11.11.11.11:22/download] Connected to
sftp://username#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://username:******#11.11.11.11:22/download] Connected and logged
in to: sftp://username#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://username:******#11.11.11.11:22/download] JSCH -> Disconnecting
from 11.11.11.11 port 22
How can I stop these messages from appearing in the log?
If you are using a logger like log4j, you can simply turn off the JSCH logging with the following line in your logger config:
log4j.logger.org.apache.camel.component.file.remote.SftpOperations = OFF
As an alternative to change the logger config, the current Camel sFTP documentation mentions few options you can set on the endpoint:
jschLoggingLevel
readLockLoggingLevel
runLoggingLevel
For example you can set:
sftp://user#myserver.mydomain.net:9921/path/to/folder?binary=true&jschLoggingLevel=WARN&readLockLoggingLevel=INFO&runLoggingLevel=WARN
You can tweak each category to fit your needs directly in the endpoint without changing the configuration of your logger.
Related
I'm using apache camel to make a ftp client for downloading some files to some local directory. The program reads a xml file to get the name of the file that will be fetched from the ftp.The program seems to work except that the files downloaded are corrupted. Right now I'm trying to download some image files but the ones I get are 14.9Kb and corrupted, no error message shown.
This is my code:
main
public void main() throws FileNotFoundException {
BasicConfigurator.configure();
RutaFtp routeBuilder = new RutaFtp();
CamelContext ctx = new DefaultCamelContext();
try {
ctx.addRoutes(routeBuilder);
ctx.start();
Thread.sleep(10000);
ctx.stop();
}
catch (Exception e) {
e.printStackTrace();
}
}
camel route:
from("file:./?fileName=Datos.xml&noop=true")
.split(xpath("//Datos/imagen/text()"))
.setProperty("rutaArchivo", this.body())
.log(LoggingLevel.INFO, "imagen: ${body}")
.process(ExtraerNombre).to("direct:ftp").end();
from("direct:ftp")
.pollEnrich("ftp://"+user+"#"+ftp+"/?password="+password+"&recursive=true&passiveMode=true&fileName=${body}&delete="+borrado+"")
.to("file:C:/outputFolder?flatten=true").end();
}
I've tried using the streamDownload parameter but tha prevents the files to be downloaded (I don't know why)
.pollEnrich("ftp://"+user+"#"+ftp+"/?password="+password+"&recursive=true&passiveMode=true&streamDownload=true&fileName=${body}&delete="+borrado+"")
console log:
INFO | Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is
starting 0 [main] INFO org.apache.camel.impl.DefaultCamelContext -
Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is starting
INFO | JMX is enabled 10 [main] INFO
org.apache.camel.management.ManagedManagementStrategy - JMX is
enabled INFO | Loaded 185 type converters 208 [main] INFO
org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 185
type converters INFO | AllowUseOriginalMessage is enabled. If access
to the original message is not needed, then its recommended to turn
this option off as it may improve performance. 395 [main] INFO
org.apache.camel.impl.DefaultCamelContext - AllowUseOriginalMessage
is enabled. If access to the original message is not needed, then its
recommended to turn this option off as it may improve performance.
INFO | StreamCaching is not in use. If using streams then its
recommended to enable stream caching. See more details at
http://camel.apache.org/stream-caching.html 395 [main] INFO
org.apache.camel.impl.DefaultCamelContext - StreamCaching is not in
use. If using streams then its recommended to enable stream caching.
See more details at http://camel.apache.org/stream-caching.html INFO
| Endpoint is configured with noop=true so forcing endpoint to be
idempotent as well 395 [main] INFO
org.apache.camel.component.file.FileEndpoint - Endpoint is configured
with noop=true so forcing endpoint to be idempotent as well INFO |
Using default memory based idempotent repository with cache max size:
1000 395 [main] INFO org.apache.camel.component.file.FileEndpoint -
Using default memory based idempotent repository with cache max size:
1000 INFO | Route: route1 started and consuming from:
Endpoint[file://./?fileName=Datos.xml&noop=true] 502 [main] INFO
org.apache.camel.impl.DefaultCamelContext - Route: route1 started and
consuming from: Endpoint[file://./?fileName=Datos.xml&noop=true] INFO
| Route: route2 started and consuming from: Endpoint[direct://ftp] 504
[main] INFO org.apache.camel.impl.DefaultCamelContext - Route: route2
started and consuming from: Endpoint[direct://ftp] INFO | Total 2
routes, of which 2 is started. 504 [main] INFO
org.apache.camel.impl.DefaultCamelContext - Total 2 routes, of which
2 is started. INFO | Apache Camel 2.15.1.redhat-621084 (CamelContext:
camel-1) started in 0.504 seconds 507 [main] INFO
org.apache.camel.impl.DefaultCamelContext - Apache Camel
2.15.1.redhat-621084 (CamelContext: camel-1) started in 0.504 seconds INFO | Created default XPathFactory
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl#5434283f 1533
[Camel (camel-1) thread #0 - file://./] INFO
org.apache.camel.builder.xml.XPathBuilder - Created default
XPathFactory
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl#5434283f INFO
| imagen: ftp://190.0.56.190:8021/pruebasumman/conductor/71708375.jpg
1635 [Camel (camel-1) thread #0 - file://./] INFO route1 - imagen:
ftp://190.0.56.190:8021/pruebasumman/conductor/71708375.jpg INFO |
Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is shutting
down 10521 [main] INFO org.apache.camel.impl.DefaultCamelContext -
Apache Camel 2.15.1.redhat-621084 (CamelContext: camel-1) is shutting
down INFO | Starting to graceful shutdown 2 routes (timeout 300
seconds) 10524 [main] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Starting to graceful
shutdown 2 routes (timeout 300 seconds) INFO | Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 300
seconds. 10524 [Camel (camel-1) thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 300
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 299 seconds. 11525 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 299
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 298 seconds. 12528 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 298
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 297 seconds. 13529 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 297
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 296 seconds. 14540 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 296
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 295 seconds. 15555 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 295
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 294 seconds. 16568 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 294
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 293 seconds. 17569 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 293
seconds. INFO | Waiting as there are still 3 inflight and pending
exchanges to complete, timeout in 292 seconds. 18574 [Camel (camel-1)
thread #2 - ShutdownTask] INFO
org.apache.camel.impl.DefaultShutdownStrategy - Waiting as there are
still 3 inflight and pending exchanges to complete, timeout in 292
seconds.
Thanks in advance.
Download image file in binary mode
By default, Camel FTP is downloading file by ASCII mode.
Add binary=true into your ftp route will turn from ASCII mode to binary mode
I have recently moved my routes over to use XA, I am not sure if this is normal behavior or a problem but I am seeing continual reconnecting in the log and the transaction logs are growing when there is no activity as such on the jms queue.
The logs show the following
16:14:19.777 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.datasource.xa.XAResourceTransaction-logInfo - XAResource.start ( 31302E3136322E3230382E3130322E746D30303030323030303032:31302E3136322E3230382E3130322E746D32 , XAResource.TMNOFLAGS ) on resource ConnectionFactoryTESTQM represented by XAResource instance com.ibm.mq.jmqi.JmqiXAResource#27520e8f
16:14:20.806 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsXaSessionProxy-logInfo - atomikos xa session proxy for resource ConnectionFactoryTESTQM: calling getTransacted on JMS driver session...
16:14:20.806 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsMessageConsumerProxy-logInfo - atomikos MessageConsumer proxy for com.ibm.mq.jms.MQQueueReceiver#690215c4: close...
16:14:20.822 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.datasource.xa.XAResourceTransaction-logInfo - XAResource.end ( 31302E3136322E3230382E3130322E746D30303030323030303032:31302E3136322E3230382E3130322E746D32 , XAResource.TMSUCCESS ) on resource ConnectionFactoryTESTQM represented by XAResource instance com.ibm.mq.jmqi.JmqiXAResource#27520e8f
16:14:20.838 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsXaSessionProxy-logInfo - atomikos xa session proxy for resource ConnectionFactoryTESTQM: closing session atomikos xa session proxy for resource ConnectionFactoryTESTQM - is terminated ? false
16:14:20.838 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsConnectionProxy-logInfo - atomikos connection proxy for resource ConnectionFactoryTESTQM: close()...
16:14:20.838 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.icatch.imp.CompositeTransactionImp-logInfo - commit() done (by application) of transaction 10.162.208.102.tm0000200002
16:14:20.978 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.datasource.xa.XAResourceTransaction-logInfo - XAResource.commit ( 31302E3136322E3230382E3130322E746D30303030323030303032:31302E3136322E3230382E3130322E746D32 , true ) on resource ConnectionFactoryTESTQM represented by XAResource instance com.ibm.mq.jmqi.JmqiXAResource#27520e8f
16:14:21.009 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.icatch.imp.BaseTransactionManager-logInfo - createCompositeTransaction ( 300000 ): created new ROOT transaction with id 10.162.208.102.tm0000300002
16:14:21.009 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosConnectionFactoryBean-logInfo - AtomikosConnectionFactoryBean 'ConnectionFactoryTESTQM': createConnection()...
16:14:21.009 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosConnectionFactoryBean-logInfo - AtomikosConnectionFactoryBean 'ConnectionFactoryTESTQM': init...
16:14:21.009 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsConnectionProxy-logInfo - atomikos connection proxy for resource ConnectionFactoryTESTQM: creating XA-capable session...
16:14:21.134 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsConnectionProxy-logInfo - atomikos connection proxy for resource ConnectionFactoryTESTQM: calling hashCode on JMS driver...
16:14:21.134 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsConnectionProxy-logInfo - atomikos connection proxy for resource ConnectionFactoryTESTQM: calling hashCode on JMS driver...
16:14:21.134 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsConnectionProxy-logInfo - atomikos connection proxy for resource ConnectionFactoryTESTQM: calling start on JMS driver...
16:14:21.134 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsXaSessionProxy-logInfo - atomikos xa session proxy for resource ConnectionFactoryTESTQM: calling createQueue on JMS driver session...
16:14:21.134 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsXaSessionProxy-logInfo - atomikos xa session proxy for resource ConnectionFactoryTESTQM: calling createConsumer on JMS driver session com.ibm.mq.jms.MQXASession#41a4d0d0
16:14:21.150 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsMessageConsumerProxy-logInfo - atomikos MessageConsumer proxy for com.ibm.mq.jms.MQQueueReceiver#3cb81a5f: receive ( 1000 )...
16:14:21.150 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.jms.AtomikosJmsMessageConsumerProxy-logInfo - atomikos MessageConsumer proxy for com.ibm.mq.jms.MQQueueReceiver#3cb81a5f: receive ( 1000 , null )...
16:14:21.150 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.icatch.imp.CompositeTransactionImp-logInfo - registerSynchronization ( com.atomikos.jms.ConsumerProducerSupport$JmsRequeueSynchronization#4d70e77 ) for transaction 10.162.208.102.tm0000300002
16:14:21.150 [Camel (camel-1) thread #0 - JmsConsumer[AAA.TESTQ1]] INFO com.atomikos.icatch.imp.CompositeTransactionImp-logInfo - addParticipant ( XAResourceTransaction: 31302E3136322E3230382E3130322E746D30303030333030303032:31302E3136322E3230382E3130322E746D33 ) for transaction 10.162.208.102.tm0000300002
If this is normal then I will just surpress the logging but I figured it worth checking.
thanks
Paul
I have multiple camelContexts created and would like each camelContext to use their own custom threadpool. However, the log shows all my camelContexts are using the same threadpool. What am I missing?
Main Camel Context
<camelContext id="routeLoader_route">
(no threadpool defined)
<route id="RouteCreator" >
<from uri="file://jsonFilePath" />
<bean ref="routeMonitor" method="loadJsontoCreateRoute" />
</route>
(some other routes defined)
</camelContext>
The method "loadJsontoCreateRoute" will read three json files and then create three routes to connect from
endpoint "file://xxx1/out" to endpoint "direct-vm:out.test"
endpoint "file://xxx2/out" to endpoint "direct-vm:out.test"
endpoint "file://xxx3/out" to endpoint "direct-vm:out.test"
Another camel context
<camelContext id="test_out_route">
<threadPoolProfile id="outTestThreadPoolProfile" defaultProfile="true" poolSize="1" maxPoolSize="1" maxQueueSize="1000" rejectedPolicy="CallerRuns"/>
<route id="outboundTestingRouter">
<from uri="direct-vm:out.test"/>
<doTry>
<log message="Outbound Test -- START" loggingLevel="INFO" />
<recipientList>
<method ref="outTestBean" method="dynamicRoute" />
</recipientList>
<doFinally>
<log message="Outbound Test-- END" loggingLevel="INFO" />
<stop/>
</doFinally>
</doTry>
</route>
(Some other routes defined)
</camelContext>
The dynamicRoute method will return a uri for ftp component
Log
20160623 09:48:04.297 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.524 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.526 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.527 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.634 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.636 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.652 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.653 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.749 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.749 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.827 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.827 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.890 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.937 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:04.937 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:04.999 [Camel (routeLoader_route) thread #24 - file://xxx3/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:05.140 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:05.358 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:05.358 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:05.469 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:05.471 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:05.593 [Camel (routeLoader_route) thread #5 - file://xxx1/out] INFO outboundTestingRouter - Outbound Test -- END
20160623 09:48:05.905 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- START
20160623 09:48:05.999 [Camel (routeLoader_route) thread #17 - file://xxx2/out] INFO outboundTestingRouter - Outbound Test -- END
Line 3 to line 10 of the log shows that there is more than 1 outboundTestingRouter route is concurrently running while my threadpool outTestThreadPoolProfile pool size is limit to 1
This indicates that the threadpool outTestThreadPoolProfile is not being used by outboundTestingRouter route
What I do want is to limit the max. number of concurrent usage of route outboundTestingRouter.
Hmm looks like that should work. What about the logging statement says your not using your threadpool?
Things to note:
1) Your route needs to be leveraging a thread pool to make off of the default template.
2) You can always manually assign a threadpool to a component typically with syntax similar to: executorServiceRef="outTestThreadPoolProfile" but make sure you check your component's documentation
3) If your default threadpool profile isn't working you can simply use the standard ThreadPool tag to make an isolated threadpool that can be assigned directly to a component.
Can anyone suggest how to specify the keyPairProvider option with Camel SSH component?
I am trying to connect to a remote SSH server using Camel SSH component and KeyPairProvider option. The documentation is not clear on how to use this option, the syntax or the value we need to provide etc. I have tried giving the classname, full classpath, key file name etc. Nothing works. I always get the below error.
Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: keyPairProvider as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.apache.sshd.common.KeyPairProvider with value file:com.example.tree.custom.CustomFileKeyPairProvider
at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:555)
at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:565)
at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:453)
at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:264)
at org.apache.camel.component.ssh.SshComponent.createEndpoint(SshComponent.java:47)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:120)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:508)
... 18 more
This is my route
from("direct:sshroute")
.to("ssh://sshuser1#10.115.136.176?keyPairProvider=com.example.tree.custom.CustomFileKeyPairProvider")
If I do not give keyPairProvider and change the route to use password, it works fine.
I also want to mention that if I create my own SSHComponent, set the CustomFileKeyPairProvider and add it to CamelContext (as given in the tests package), it is works fine too.
But just want to know if we use default Camel Component, how do we use this option.
Thanks
- Ravi
I have been trying to come up with the answer to this because I also need to be able to deliver files via the Camel SFTP route. Luckily, I have found what works.
Basically, what you need to do is present the Private key, not the Public key, to your Camel route. The assumption here is that you generated a public key to share with the remote SSH/SFTP server, delivered that public key to the remote site and, either you or the remote administrator, placed that file in the "authorized_keys" container on the remote site.
That being said, you construct your Camel SFTP route as such:
<to uri="sftp://username#remote_server_address/directoryname?privateKeyFile=/full/path/to/your/private_key/id_dsa&knownHostsFile=/full/path/to/your/known_hosts" />
With this address, I was able to send my file to my remote destination without logging on:
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Connecting to 10.0.0.110 port 22
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Connection established
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Remote version string: SSH-2.0-OpenSSH_6.4
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Local version string: SSH-2.0-JSCH-0.1.44
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_KEXINIT sent
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_KEXINIT received
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> kex: server->client aes128-ctr hmac-md5 none
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> kex: client->server aes128-ctr hmac-md5 none
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_KEXDH_INIT sent
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> expecting SSH_MSG_KEXDH_REPLY
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> ssh_rsa_verify: signature true
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Host '10.0.0.110' is known and mathces the RSA host key
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_NEWKEYS sent
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_NEWKEYS received
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_SERVICE_REQUEST sent
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> SSH_MSG_SERVICE_ACCEPT received
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Authentications that can continue: publickey,keyboard-interactive,password
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Next authentication method: publickey
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations - JSCH -> Authentication succeeded (publickey)
I go into a bit more detail in my findings over on my website but this is the main jist. Good luck!
if you're looking for SSH connection using key pair, you can do it with the certResource option, like
from("direct:sshroute")
.to("ssh://sshuser1#10.115.136.176?certResource=file:path/to/your/private_key)
it's said in the doc that you can prefix path with classpath:, file:, or http:, but I've only tried file:.
I upgraded camel from 2.8.0 to 2.10.3 version and my sftp component started failing.
Afaik, sftp component uses stepwise by default and had no trouble to change directories previous to upgrade.
Below is a log entry that I see on camel/jsch
20130113 15:28:54,509 INFO [Camel (camel-1) thread #0 -
file://../test_outbound/] RemoteFileProducer[193]: Connected and
logged in to:
Endpoint[sftp://sftp-user#localhost/incoming?disconnect=true&privateKeyFile=xyz.ppk&privateKeyFilePassphrase=**]
20130113 15:28:54,528 WARN [Camel (camel-1) thread #0 -
file://../test_outbound/] RemoteFileProducer[71]: Writing file failed
with: Cannot change directory to: home 20130113 15:28:54,528 DEBUG
[Camel (camel-1) thread #0 - file://../test_outbound/]
RemoteFileProducer[86]: Disconnecting from:
Endpoint[sftp://sftp-user#localhost/incoming?disconnect=true&privateKeyFile=xyz.ppk&privateKeyFilePassphrase=**]
20130113 15:28:54,529 INFO [Camel (camel-1) thread #0 -
file://../test_outbound/] SftpOperations$JSchLogger[259]: JSCH ->
Disconnecting from localhost port 22 20130113 15:28:54,529 INFO
[Connect thread localhost session] SftpOperations$JSchLogger[259]:
JSCH -> Caught an exception, leaving main loop due to socket closed
Not sure why this is happening? Any ideas appreciated, thanks.
cd works with v2.8.0
20130114 18:42:52,956 INFO [Camel (camel-1) thread #0 -
sftp://user#host/outgoing] RemoteFileConsumer[133]: Connected and
logged in to: sftp://user#host:22 20130114 18:42:52,956 TRACE [Camel
(camel-1) thread #0 - sftp://user#host/outgoing] SftpOperations[339]:
getCurrentDirectory() 20130114 18:42:52,959 TRACE [Camel (camel-1)
thread #0 - sftp://user#host/outgoing] SftpConsumer[68]:
doPollDirectory from absolutePath: outgoing, dirName: null 20130114
18:42:52,959 TRACE [Camel (camel-1) thread #0 -
sftp://user#host/outgoing] SftpOperations[348]:
changeCurrentDirectory(outgoing) 20130114 18:42:52,959 TRACE [Camel
(camel-1) thread #0 - sftp://user#host/outgoing] SftpOperations[389]:
Changing directory: outgoing 20130114 18:42:52,966 TRACE [Camel
(camel-1) thread #0 - sftp://user#host/outgoing] SftpConsumer[81]:
Polling directory: outgoing 20130114 18:42:52,966 TRACE [Camel
(camel-1) thread #0 - sftp://user#host/outgoing] SftpOperations[415]:
listFiles(.) 20130114 18:42:52,982 TRACE [Camel (camel-1) thread #0 -
sftp://user#host/outgoing] SftpConsumer[94]: Found 2 in directory:
outgoing 20130114 18:42:52,982 TRACE [Camel (camel-1) thread #0 -
sftp://user#host/outgoing] SftpOperations[348]:
changeCurrentDirectory(/home/sftp-user) 20130114 18:42:52,982 TRACE
[Camel (camel-1) thread #0 - sftp://user#host/outgoing]
SftpOperations[389]: Changing directory: / 20130114 18:42:52,988 TRACE
[Camel (camel-1) thread #0 - sftp://user#host/outgoing]
SftpOperations[389]: Changing directory: home 20130114 18:42:52,994
TRACE [Camel (camel-1) thread #0 - sftp://user#host/outgoing]
SftpOperations[389]: Changing directory: sftp-user 20130114
18:42:53,000 DEBUG [Camel (camel-1) thread #0 -
sftp://user#host/outgoing] GenericFileConsumer[84]: Took 0.044 seconds
to poll: outgoing
and fails with 2.10.3
20130114 19:15:53,530 INFO [Camel (camel-1) thread #0 -
file://../test_outbound/] RemoteFileProducer[193]: Connected and
logged in to:
Endpoint[sftp://user#host/incoming?disconnect=true&knownHostsFile=known_hosts&privateKeyFile=sftp-user.ppk&privateKeyFilePassphrase=**&separator=Auto]
20130114 19:15:53,530 TRACE [Camel (camel-1) thread #0 -
file://../test_outbound/] SftpOperations[305]:
buildDirectory(incoming,false) 20130114 19:15:53,530 TRACE [Camel
(camel-1) thread #0 - file://../test_outbound/] SftpOperations[372]:
getCurrentDirectory() 20130114 19:15:53,670 TRACE [Camel (camel-1)
thread #0 - file://../test_outbound/] SftpOperations[381]:
changeCurrentDirectory(/home/sftp-user) 20130114 19:15:53,670 TRACE
[Camel (camel-1) thread #0 - file://../test_outbound/]
SftpOperations[372]: getCurrentDirectory() 20130114 19:15:53,670 TRACE
[Camel (camel-1) thread #0 - file://../test_outbound/]
SftpOperations[430]: Changing directory: \ 20130114 19:15:53,749 TRACE
[Camel (camel-1) thread #0 - file://../test_outbound/]
SftpOperations[430]: Changing directory: home 20130114 19:15:53,796
WARN [Camel (camel-1) thread #0 - file://../test_outbound/]
RemoteFileProducer[71]: Writing file failed with: Cannot change
directory to: home
Looks like separator is bad but I tried all 3 options (Windows,Unix,Auto)... none worked.
Accepted as a bug and fixed, see
https://issues.apache.org/jira/browse/CAMEL-5970