Can any one give some brief about advantages of HTTP4/HTTPS4 component in camel over http component.
In which case we need to choose which component?
The HTTP component uses the Apache HTTP client v.3, which is end of life. The HTTP4 component uses v.4.x of the HTTP client component, which is actively maintained. So if you start fresh, then you should use the http4 component.
EDIT: Camel 3 discontinued the legacy HTTP client support. The Camel http component (without the 4) is now based on version 4.5 of the Apache http components client. The Camel HTTP4 component has been removed.
Related
I'm trying to run a simple test with Apache Camel:
from("http://localhost:61554/api/v1/MyController/my-endpoint")
.to("direct:a")
.log("$({body}");
I'm getting the following error: "No endpoint could be found for: http://localhost:61554/api/v1/MyController/my-endpoint, please check your classpath contains the needed Camel component jar"
I'm very new to Camel and Java. Can someone please tell me why this error is coming up? Should I be using from("direct:x")... ? If, so where do I map my "direct" endpoints to concrete ones?
Thanks
You cannot use the http component as consumer (eg in from) - its a http client for calling HTTP servers (so its a producer, eg to).
Instead to have HTTP as consumer you can use camel-servlet, camel-jetty, camel-undertow, etc.
I am using apache camel and wants to have multiple routes.The route is as below.
endpoint -> quartz2://tsTimer?cron=0%2F20+*+8-18+%3F+*+MON%2CTUE%2CWED%2CTHU%2CFRI+*&stateful=true&trigger.timeZone=Asia%2FSingapore
Call bean method to get data.
Send to MQ
In this case my route is going to be same as the polling interval is same.
The data from bean method will be different.
And the MQ queue will be same.
Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: quartz2://tsTimer?cron=0%2F20+*+8-18+%3F+*+MON%2CTUE%2CWED%2CTHU%2CFRI+*&stateful=true&trigger.timeZone=Asia%2FSingapore
How do i achieve this? How do i differentiate camel route in case when the endpoint is quartz2 timer?
I din't notice that in endpoint uri I was having tsTimer which will distinguishes other end-points.
Something like below
quartz2://tsTimer1
quartz2://tsTimer2
quartz2://tsTimer3
I am trying to completely destroy a camel component. But the available option is to remove the camel component from the camel context, i.e. camelContext.removeComponent(componentName). But after removing the camel component from the camel context, the corresponding Endpoint, Producer and Consumer did not get destroy and when I re-created the Camel Component, it is still using the old Producer, Consumer and Endpoint. How do I completely destroy it so that once I recreate the component, it also creates new Producer, Consumer and Endpoint.
One of the use cases: We are connecting to Salesforce using apache camel to fetch metadata. Once the credentials to connect the salesforce changes/expired we need to destroy the old Salesforce component and create a new Salesforce component. We need to do this dynamically without restarting the camel context or the JVM. But once we remove the component from camel context it only destroys the Component but corresponding Endpoint, Producer, Processors, Consumers remains the same, consequentely the HTTP client of the Processor(JsonRestProcessor) remains the same which is different from the HTTP client of the newly created Salesforce component. Aslo when we remove the component and cerate the new component, then it creates the new HTTP client but the Processor(JsonRestProcessor) still refers to the old HTTP client. The old HTTP client sometimes goes to STOPPED state and our call to Salesforce fails. And when we try to start the HTTP cleint using "salesforceComponent.getConfig().getHttpClient().start()", it actuallty start the new HTTP client which is not used to connect to the Salesforce when we make a call to Salesforce. And since old HTTP client is in STOPPED state, any subsequent call to the salesforce fails.
currently, for a server to server communication, we have our own authentication method which will expect a random key in the HTTP request header.is there a way I can extend the camle HTTP to add the header for all the HTTP request call. Note we have 4 camel context XML and each camel context have 10 routes which make the HTTP request
You could also use Camel interceptors in order to add your custom header to (all or some) "http:*"-like endpoints.
Have a look at:
http://camel.apache.org/intercept.html
I've been using restlet camel component to communicate with endpoints fine for a couple of weeks now, but after I had the need to add an Authorization header to my requests, that's when I kept getting this warning:
WARNING: Addition of the standard header "Authorization" is not allowed. Please use the equivalent property in the Restlet API.
Which blocks the header from being added to the outgoing message.
I've seen solutions for this for using restlet, but I don't have the luxury when using it as a camel component.
I've tried using the org.restlet.http.headers attribute but still get the same message.
Any ideas how to make it send out my authorization header?
(I would rather not use the http component)
Note: I'm using Camel 2.19.2, same version for restlet
There is a ticket at Restlet to support this, however they have not implemented this: https://github.com/restlet/restlet-framework-java/issues/1198
There is also a Camel ticket: https://issues.apache.org/jira/browse/CAMEL-10665
As it seems Restlet takes forever to fix this on their side, we may have to bit the bullet and make a special fix in the camel-restlet component