Camel jsch component - apache-camel

Can some one provide an example of a working camel route for jsch component? I need to use scp from camel. I tried:
from("file:tmp/")
.to("scp://server?username=user&password=pass");
but it doesn't work

Your code should work.
Check your logs... maybe do you need a knownHostsFile.
I did something like this:
scp://server/output/?username=user&password=pass&knownHostsFile=C:\\llave.txt"
(Sorry for my english)

Related

Apache camel Endpoint schemes duplication

in apache camel, we have endpoints associated with scheme strings like "cxf", "ahc", "http" and the likes. What happens if there are two components built using the same scheme? I don't see a validation from camel framework which prevents the deployment of components with duplicate schemes. Should there be a validation in the first place or this is by design?
Regards
Gopal
I have a need to re-use available camel components from the community but change the endpoint scheme to make it unique. For example I want to use amqp component but in my blueprint route i would like to have unique scheme used "<camel from uri="mydomain-amqp">. This way I can re-use the amqp as a new component but also keep others using the amqp as is.
Camel prevents adding a component using a name/scheme that already exists. Adding your component under a different name would be something like this:
getContext().addComponent("mydomain-amqp", new AMQPComponent());

Is there a KairosDB component for Apache Camel?

I can't find a Camel component for KairosDB. Is there none?
Should I write a custom component or is there a smarter way?
Thanks
There is no official component for that. You can find the list of components at: https://github.com/apache/camel/tree/master/components#components
Yes you would need to write your own component, or just use regular Java code in a Java bean to integrate with KairosDB and then Camel can integrate with your Java bean. Or use a Camel Processor instead of a Java bean.
But writing a component is not so hard, and if you use KairosDB in more projects with Camel then it starts to make sense to build a Camel component for it. The Apache Camel project loves contributions: http://camel.apache.org/contributing

Validate Camel route programmatically

I'm working on a logging solution where Camel routes are defined at runtime with a Java DSL String. I wonder if there's a way to check programmatically some errors such as components not found in the route. The only option I was able to find is catching the org.apache.camel.ResolveEndpointFailedException and dig into the error message. Is there a better way to validate the route?
Just to give an example, it would be good to ascertain if a route syntax is completely wrong or if just a component wasn't found so that I can output a message e.g. "install ftp component".
You can use Fabric8 Camel Maven Plugin (http://fabric8.io/guide/camelMavenPlugin.html) for validating Camel endpoints in the source code.
Look at this article by Claus Ibsen to get more information : https://blog.fabric8.io/cheers-fabric8-camel-maven-plugin-to-validate-camel-endpoints-from-source-code-8768aff76b41#.wcji8hfdg

Debugging Camel Headers

I need to work on some Camel routes which contain lot of CBR based on the headers:
<simple>${header.CamelFileName} regex '^.*xml$'</simple>
It would be very helpful to debug the content of the Headers of the Routes: do you recommend any component/processor ?
Thanks!
You can use Log component for that task (http://camel.apache.org/log.html)
<to uri="log:like-to-see-all?level=INFO&showAll=true&multiline=true"/>
This code will help you to see all message headers
I would recommend the DSL Log : http://camel.apache.org/logeip.html which is more confortable and comprehensible to use instead of a Log component (http://camel.apache.org/log.html) to debug headers.
<log message="CamelFileName : ${header.CamelFileName}; you can use simple langage" loggingLevel="FATAL" logName="com.mycompany.MyCoolRoute"/>
From the doc :
Difference between log in the DSL and [Log] component
The log DSL is
much lighter and meant for logging human logs such as Starting to do
... etc. It can only log a message based on the Simple language. On
the other hand Log component is a full fledged component which
involves using endpoints and etc. The Log component is meant for
logging the Message itself and you have many URI options to control
what you would like to be logged.
Hope

Transacted camel route with auto-startup set to false

I am in the process of developing a message router which has a bunch of routes that are started and stopped at runtime based some certain conditions.
By default all these routes are configured with auto-starup=false
Now I am trying to add transactional support to these routes and it seems that you cannot define a transacted route and control the its startup behavior at the same time. This is because RouteDefinition.transacted() returns a TransactedDefinition instance which does not have an autoStartup(boolean autoStartup) method.
I am sure I am not the only one to need this kind of functionality and just wondering what is the camel way of addressing such requirements.
Thank you in advance for your inputs
Maybe just set autoStartup first, eg
from("direct:start").autoStartup(false)
.transacted()
.to("mock:result");

Resources