I am storing sensitive information like password, APIKey etc in JBoss AS vault.I need to retrieve it in camel route and set camel exchange headers.
I tried in below it is not working.
<setHeader headerName="apikey">
<simple>{{VAULT::event_policy_online::password::1}}</simple>
</setHeader>
how can i achieve it?
You can create an EAP system property (for example, myfusepassword) for the password you created in the vault.
Then the password can be accessed in the camel configuration by using the following notation:
${sys.myfusepassword}
Related
Lets say that I want to communicate to a rest service with SSL with Camel, and I'm creating a custom HttpClientConfigurer which will set that stuff:
<bean id="myHttpClientConfigurer"
class="my.https.HttpClientConfigurer">
</bean>
<to uri="https://myhostname.com:443/myURL?httpClientConfigurerRef=myHttpClientConfigurer"/>
And the HttpClientConfigurer implements org.apache.camel.component.http.HttpClientConfigurer.
So my question is, will this custom HttpClientConfigurer will be active for only that route (where I specify it with httpClientConfigurerRef)? Or will it affect other Camel routes that use the http component?
Just for that route. Always test and verify! Fire up a second route without it and you should observe that the second route does not handle the SSL handshake.
I have a bean setup which returns a decoded password for a keystore. For CXF calls I can get the password using #{decoder.keystorePassword} but when I try to do the same thing from camel:keyStore password for a rest call, it doesn't work and just uses #{..} as the password. I imagine the syntax for referencing a bean is slightly different because I am in a camel component?
Any suggestions on how to get the value here?
I don't even know if I formulated the question the right way around ;-)
What I basically want to achieve is something like this:
<route >
<from uri="osgi:serviceName"/>
<!-- do some processing ->
<to uri="activemq:queue:inbox"/>
</route>
So I'd like to have an OSGi Service as starting point of my route. This service can be referenced by some other bundles and fed with input data, that will be later on processed by the Route.
How would I do this?
Simply create an OSGi service outside of camel and a route that starts with direct:anyname. Then you can inject a ProducerTemplate into your service an call the route from there.
If you have really simple method signature, or typeConverter for the parameters you want to pass, you can use CamelProxy to link the service to your route in a simple XML configuration file.
To extends the example of the doc, you would have something like :
<osgi:service id="service" ref="myProxySender" (4)
interface="org.apache.camel.spring.config.MyProxySender" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- create a proxy that will route to the direct:start endpoint when invoked -->
<proxy id="myProxySender"
serviceInterface="org.apache.camel.spring.config.MyProxySender"
serviceUrl="direct:start"/>
<!-- this is the route that our proxy will routed when invoked
and the output from this route is returned as reply on the proxy -->
<route>
<from uri="direct:start"/>
<transform>
<simple>Bye ${body}</simple>
</transform>
</route>
</camelContext>
To use "osgi" as the URI scheme in a Camel route, you would need to create a custom Camel component to handle invoking the relevant OSGi commands. For more information, please see http://camel.apache.org/creating-a-new-camel-component.html
A simpler alternative would be to write custom OSGi commands that used a ProducerTemplate to send messages to a Camel route. An example for Karaf can be found here: https://github.com/apache/karaf/tree/master/demos/command
Injecting a ProducerTemplate can be done via standard Spring configuration.
I am using a CXF component which will take username and password as its properties and I am getting username and password in Camel Exchange Header, So I tried to set this way:
<to uri="cxf:{myurl}?dataFormat=MESSAGE&username=${in.header.username}&password=${in.header.password}"/>
But it is giving me authentication failure error as username and password are not set properly.
See this FAQ about how to use dynamic values in the to
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html
So by using recipient list EIP you can do this
<recipientList>
<simple>cxf:{myurl}?dataFormat=MESSAGE&username=${in.header.username}&password=${in.header.password}"</simple>
</recipientList>
I am using camel and camel-restlet component for routing RESTFul web services. My route configuration looks like:
<from uri="restlet:/camel/my/path/{param1}/{param2}?restletMethods=PUT&throwExceptionOnFailure=false" />
<loadBalance inheritErrorHandler="false">
<failover roundRobin="true" maximumFailoverAttempts="2">
<exception>java.io.IOException</exception>
</failover>
<to uri="http://server1:8080/my/path/${header.param1}/${header.param2}?bridgeEndpoint=true&throwExceptionOnFailure=false" />
<to uri="http://server2:8080/my/path/${header.param1}/${header.param2}?bridgeEndpoint=true&throwExceptionOnFailure=false" />
</loadBalance>
I have some input route configurations like:
restlet:/camel/my/path/{param1}/{param2}?restletMethods=PUT
restlet:/camel/my/path/param1/{param2}?restletMethods=GET
When a call comes as GET: /my/path/param1/foo, Restlet is routing this request to the first router and the request is failing with 404. I am expecting restlet to route this request to second router. I went the post restlet-routing-nightmare, but in my case, I cannot change the URIs as I am just doing the routing part with camel and I have no control on the URIs of the underlying services. Underlying services are on Jersey framework and they don't have issues with these type of URL patterns.
Can anyone suggest a solution for this in restlet/camel.
You need to have throwExceptionOnFailure=true on the uris in the load balancer so the failover load balancer can react on the exception. Otherwise it assumes the process was successful.