Earlier in version 2.1x, from() was having String[] as parameter, but now at 3.0.0-m2 that feature is removed (only 1 endpoint can be given)
Could you please advice how to handle multiple endpoints in from() ?
This was not fully implemented and endorsed in Camel 1.x btw. In Camel 2 it has been removed and you should conform to 1 endpoint per route.
Also make sure to read the migration guide which you can find on github
Related
The version of Apache Camel is 2.18.1
In documentation for 2.x, https://camel.apache.org/components/2.x/http4-component.html, getWithBody and deleteWithBody options as query parameters are provided.
deleteWithBody (producer) : Whether the HTTP DELETE should include the message body or not. By default HTTP DELETE do not include any HTTP body. However in some rare cases users may need to be able to include the message body. Default: false
getWithBody (producer) : Whether the HTTP GET should include the message body or not. By default HTTP GET do not include any HTTP body. However in some rare cases users may need to be able to include the message body. Default false
But when I concatenate one of these 2 parameters at the end of the endpoint URI, it's not recognized as an option. Instead, it's passed to the endpoint as an ordinary query parameter, while other query parameter options are treated as component options and not forwarded to the endpoint.
When I inspect the source code, I see that options are recognized by matching with the fields and methods of HttpEndpoint (org.apache.camel.component.http4) and HttpCommonEndpoint (org.apache.camel.http.common) classes. getWithBody and deleteWithBody fields doesn't exist in these classes while other options can be found among the fields of these classes.
Can I assume that the documentation is wrong? If so, how can I achieve to send body with HttpComponent(Http4Component) of Camel while the http method is GET or DELETE?
Option deleteWithBody was introduced in Apache Camel 2.19.0. See CAMEL-10916.
Option getWithBody was introduced in Apache Camel 3.0.0 and backported to 2.25.0. See CAMEL-14118.
For such old version use docs archived on github, it is not published on website - https://github.com/apache/camel/blob/camel-2.18.x/components/camel-http4/src/main/docs/http4-component.adoc
You need to update to newer version or implement custom component overriding some methods from HTTP4 component. There is no option to enable this OOTB in 2.18.1.
i agree with the answer given by #Bedla.
to add something additional this is what we did .
We checked the code and debugged - this allowed us to realize that at a point were camel interacts it drops the body if a GET Call has a one. it will be send as a normal GET Request because Camel version 3.x.x only supports it.
we tried different ways to forcefully add the body. that was also failed because what ever we add will be discarded by camel.
we were using camel v2.22.1 at the time. going to a higher version such as camel 3.x.x will be a big leap since there are multiple changes that will be included , so lucky for us camel team back ported this ability to send the GET Request with the Body (from here on getWithBody) to camel v2.25.0
coding level changes :
Append getWithBody=true to the Request URL
Updated camel Modules
camel-core-2.25.0.jar
camel-cxf-transport-2.25.0.jar
camel-cxf-2.25.0.jar
camel-core-xml-2.25.0.jar
camel-http-common-2.25.0.jar
camel-jaxb-2.25.0.jar
camel-spring-2.25.0.jar
camel-soap-2.25.0.jar
camel-cdi-2.25.0.jar
camel-jdbc-2.25.0.jar
camel-http4-2.25.0.jar
****special note ****
Note that under each folder location, there is a modules.xml file. You need yo open that and change the jar file version number to the one you want to use. in this case 2.25.0
That’s it and Happy Coding !
We already have project which received request on REST EndPoint and by
using FINITE STATE Machine evaluate next action with Transition and
call action class accordingly.
I am assigned to evaluate possibility to migrate this part to apache camel.
But i am not seeing any value addition as in camel we already defined
routes and we can also use dynamic routing for evaluating next
endpoint.
I googled but couldnt find any Apache Camel example using FSM.
I need comments any use case where we can use FSM in Apache Camel or
we dont require due to nature of Camel.
if anyone found any links for google please share it to.
https://dzone.com/articles/why-developers-never-use-state
Regards,
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 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.
We are tying to use a WebService OutFaultInterceptor as per this blog post and it doesn't seem to work in JBoss 7.x.
The problem is simple in that it just ignores the #OutFaultInterceptor annotation. I tested this by putting in a erroneous interceptor name and it didn't error out. Logging within the interceptor is simply not called (when the interceptor name is correct).
I have also tried using the WEB-INF/jboss-webservices.xml to define out interceptors but that also seems to get ignored.
Removing the #Stateless annotation also does not seem to help.
This was working fine on JBoss 5.1 but simply seems to not work on JBoss 7.x. What am I missing here?
Is there an alternative way to "translate" exceptions into soap faults?
In order for using Apache CXF APIs and implementation classes you need to add a dependency to the org.apache.cxf (API) module and / or org.apache.cxf.impl (implementation) module.
Dependencies: org.apache.cxf services
According documentation:
When using annotations on your endpoints / handlers such as the Apache
CXF ones (#InInterceptor, #GZIP, ...) remember to add the proper
module dependency in your manifest. Otherwise your annotations are not
picked up and added to the annotation index by JBoss Application
Server 7, resulting in them being completely and silently ignored
See also: JBoss Modules
I hope this help.