You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vadimiron <va...@sedo.com> on 2014/07/15 09:28:10 UTC

Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

We have some external service - the requests to this service are sent from
our camel route with jetty client (producer).
The url of this service is the following -
http://host/some/service/methodname/id
id is dynamic - it is some parameter, that is different in each request.

.to("endpoint_uri") operator doesn't allow (parse) dynamic parts of the url
(for example, id as header value).
To overcome this issue we used recipientList as described here -
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

Now we have a problem - recipientList thinks (is it so?), that each request
is a new endpoint and creates the new JettyClient ThreadPool with 8 threads
- and this happens by each request (because id is always different).

How can we solve this problem?
What is the right way in camel to send request to http service, which has
parameters as parts of the url?



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah see this too
http://camel.apache.org/how-to-remove-the-http-protocol-headers-in-the-camel-message.html

On Tue, Jul 15, 2014 at 11:28 AM, vadimiron <va...@sedo.com> wrote:
> No - my last message was wrong - this simple route is working now.
>
> I think i must remove all possible headers (Camel*, Host etc.) after other
> HTTP requests, that are executed before my request
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753829.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by vadimiron <va...@sedo.com>.
No - my last message was wrong - this simple route is working now.

I think i must remove all possible headers (Camel*, Host etc.) after other
HTTP requests, that are executed before my request



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753829.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by vadimiron <va...@sedo.com>.
Some more information:

as starting point of our route we have a jetty server

from("jetty:http://0.0.0.0:8080/myservice?httpClient.idleTimeout=30000&httpClient.soTimeout=30000")
.setHeader(Exchange.HTTP_URI, simple("http://172.29.15.37/service/lala"))
.to("http://localhost")

That the whole route, that i am testing now - the request ( .to() ) goes to
http://localhost, and not to http://172.29.15.37/service/lala



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753828.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by Claus Ibsen <cl...@gmail.com>.
Check unit tests of camel-jetty / camel-http for samples.

On Tue, Jul 15, 2014 at 11:09 AM, vadimiron <va...@sedo.com> wrote:
> That doesn't help - i have already rewritten my route to:
> .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
> .setHeader("CamelHttpUri",
> simple("http://localhost/myservice/${header.myparam}"))
> .to("http://dummyhost")
> but the request goes always to dummyhost.
>
> What else can i check?
>
> Before this request there are 2 other HTTP requests - one of them is POST,
> thats why i set HttpMethods.GET before calling my request.
> bridgepoint=true is now removed from all endpoints.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753825.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by vadimiron <va...@sedo.com>.
That doesn't help - i have already rewritten my route to:
.setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
.setHeader("CamelHttpUri",
simple("http://localhost/myservice/${header.myparam}")) 
.to("http://dummyhost")
but the request goes always to dummyhost.

What else can i check?

Before this request there are 2 other HTTP requests - one of them is POST,
thats why i set HttpMethods.GET before calling my request.
bridgepoint=true is now removed from all endpoints.



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753825.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by Claus Ibsen <cl...@gmail.com>.
Turn off bridgeEndpoint

On Tue, Jul 15, 2014 at 10:30 AM, vadimiron <va...@sedo.com> wrote:
> Does it work with the jetty http client?
>
> This doesn't work - URI is not rewritte
>
> .setHeader("CamelHttpUri", simple("http://localhost/myservice/${myparam}"))
> .to("jetty:dummy?bridgeEndpoint=true&httpClient.soTimeout=15000&httpClient.timeout=30000&httpClient.connectTimeout=5000")
>
> The tracer shows, that request goes to dummy - CamelHttpUri header is
> ignored
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753823.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by vadimiron <va...@sedo.com>.
Does it work with the jetty http client?

This doesn't work - URI is not rewritte

.setHeader("CamelHttpUri", simple("http://localhost/myservice/${myparam}"))
.to("jetty:dummy?bridgeEndpoint=true&httpClient.soTimeout=15000&httpClient.timeout=30000&httpClient.connectTimeout=5000")

The tracer shows, that request goes to dummy - CamelHttpUri header is
ignored
			



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819p5753823.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic Endpoint URI - jetty producer's too many threads - Request parameter as part of the URL

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Do not use recipient list, but a single endpoint. And use a header
with the dynamic http url or query parameters to use. Those headers is
documented at http://camel.apache.org/http

On Tue, Jul 15, 2014 at 9:28 AM, vadimiron <va...@sedo.com> wrote:
> We have some external service - the requests to this service are sent from
> our camel route with jetty client (producer).
> The url of this service is the following -
> http://host/some/service/methodname/id
> id is dynamic - it is some parameter, that is different in each request.
>
> .to("endpoint_uri") operator doesn't allow (parse) dynamic parts of the url
> (for example, id as header value).
> To overcome this issue we used recipientList as described here -
> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>
> Now we have a problem - recipientList thinks (is it so?), that each request
> is a new endpoint and creates the new JettyClient ThreadPool with 8 threads
> - and this happens by each request (because id is always different).
>
> How can we solve this problem?
> What is the right way in camel to send request to http service, which has
> parameters as parts of the url?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-Endpoint-URI-jetty-producer-s-too-many-threads-Request-parameter-as-part-of-the-URL-tp5753819.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/