I use Apache Camel 2.20x.
A camel component can be developed with a uri scheme for example "sample-component". Now the Endpoint of this component can actually extend an existing Endpoint say SQL which has uri syntax as "sql:<select query">.
Now I am listening to camel Exchange event (ExchangeSentEvent) When I retrive the uri from the event I get "sql:<select query">. But what I want is to get "sample-component". How can we achieve that. In simple terms following is the ask
How can we get all Endpoint uri schemes for a camel component.
Thanks in advance
Gk
ComponentName+Endpoint . You can see all the uri that the component will take. All camel components are named this way.There may be exceptions. also if u use intellij idea apache camel plugin it show .
examples
HttpEndpoint
TimerEndpoint
SedaEndpoint
DirectEndpoint
You can also find the consumer and producer classes of these components as follows.
HtppProducer if support HttpConsumer ..
Related
According to apache camel document
useSystemProperties could be used as query param for http component like below shown
https://URL ?useSystemProperties=true
But I want to use do it via API(method) way. Is it possible and how?
Thanks in advance
When I got an error inside an Endpoint URI the camel context wont start.
It seems like Camel validates in a first step every Endpoint URI before starting the context.
Can someone pleas tell me, how this works?
Am I right?
I cant figure it out.
Yes Camel validates that it has been configured correctly when it startup. This happens as part of starting the Camel routes.
Its like misconfiguring any other software which will report an error for you to fix.
There is some tooling which you can use to validate your source code to find endpoints that has been misconfigured. I wrote a blog entry about this: http://www.davsclaus.com/2016/01/cheers-fabric8-camel-maven-plugin-to.html
Actually I am playing with apache-camel 2.15.2, the REST DSL available since Camel 2.14 is not complicated. However I can't find in the official documentation how to retrieve a query parameter, basically I would like to target my REST service in this way:
http://myServer/myService/myMethod?myQueryParam=myValue
Is that possible, or is there any workaround ?
Thanks in advance.
Camel uses the REST/HTTP component of choice (restlet, jetty, servlet, netty-http, spark-rest, etc) which maps query parameters as Camel message headers.
So yes you can with the rest-dsl exposes a REST service where clients can call it with query parameters, which is then mapped to Camel message headers during routing.
I have a camel route setup like the following to send a java object to an activemq queue.
from("direct:clientRequest")
.marshal().json(JsonLibrary.Jackson)
.to("activemq:queue:command");
I want to do the following:
Map the "clientRequest" uri to some Java method
Use ProducerTemplate's "sendBody" method to send a JSON form of a Java object to the activemq queue.
Is this possible?
I am asking this question after a lot of homework. Please suggest a way to do this.
You can use pojo producing in Apache Camel. See this page for more details
http://camel.apache.org/pojo-producing.html
And there is an example that shows more about using pojo producing/consuming in Camel
http://camel.apache.org/pojo-messaging-example.html
In a route (that exposes a REST service) i need to get the local host address/domain (so as I can build links to be included in a response body)
Is there a way to get the local host address from within camel ?
PS : running camel inside servicemix
there isn't a Camel specific way (that I know of), I'd just use an external property file to configure environment specific settings like this...you can then use camel properties to pull this in, etc.
A good idea when posting questions is to provide more details.
Which camel component do you use for REST. And which version of SMX/Camel do you use etc.
As you question assume that the rest component in Camel will expose a hostname information.
This questions is not Camel specific per see, as you can use the regular Java API to get the hostname.