Camel amqp uri with exchange and routingkey - apache-camel

I'm trying to use build a amqp uri with camel, follow the
camel official document for amqp:
On the documents I found the uri for amqp ls like amqp:destinationType:destinationName.
I don't find any parameter for exchange and routingKey. How could I add these parameters to amqp uri?
I have tried amqp:destinationType:destinationName?exchangeName=aaa&routingKey&routingKey=bbb, but not works.
Thanks if any help!

Related

using useSystemProperties for apache camel http component

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

Apache camel - How to retrieve Endpoint URIs for a given Component

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 ..

How to inject query parameters using camel REST DSL?

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.

How to access a remote web service by Camel CXF endpoint?

I was looking up online how to create a Camel's CXF producer (i.e. create a CXF endpoint that would produce a request to some local/remote web service). Generally, all the examples I could find would list the following steps:
First define the cxfEndpoint attributes:
<cxf:cxfEndpoint
id="orderEndpoint"
address="http://localhost:9000/order/"
serviceClass="camelinaction.order.OrderEndpoint"/>
Then send the request to that endpoint:
...to("cxf:bean:orderEndpoint");
Hmmm. I don't understand the concept. If this is a remote web service, all I usually have is the URL of the WSDL. I can get from it the address of the service... but I don't know what the serviceClass is and I don't have it on my classpath.
So how do I define that cxfEndpoint in case I only have the URL of the WSDL?
Or is there another type of endpoint I should use in that case?
I would suggest looking into WSDL first for cxf. Below are two links that I think should help you out quite a lot and has helped me in the past as well.
http://code.notsoclever.cc/camel-cxf-component-wsdl-first-example/
https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.0/html-single/Web_Services_and_Routing_with_Camel_CXF/index.html#ImplWs-WsdlFirst
On the Red Hat site you will need to start at chapter 3.
Hope this helps.

Using Apache Camel ProducerTemplate to send JSON message to ActiveMQ

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

Resources