[ 
https://issues.apache.org/jira/browse/CAMEL-6636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-6636.
--------------------------------

    Resolution: Duplicate
      Assignee: Claus Ibsen

Duplicate of CAMEL-6078
                
> HttpClient 4.3 sets a global port to be re-used by endpoints that do not have 
> port defined
> ------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6636
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6636
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.11.0
>            Reporter: Per Jørgen Walstrøm
>            Assignee: Claus Ibsen
>
> two routes within the same camel-context are configured as shown below. They 
> post to two different URLs; route1 stating no port (implicitly, this should 
> mean port 80) and route2 stating port 81.
> During start-up, the following is logged
> {{
> 12:06:52.316 [main] INFO  o.a.c.component.http4.HttpComponent - Registering 
> PLAIN scheme http4 on port 80
> 12:06:52.372 [main] INFO  o.a.c.component.http4.HttpComponent - Registering 
> PLAIN scheme http4 on port 81
> }}
> when the post is actually done, the following is logged
> {{
> 12:18:46.437 [Camel (d-2) thread #8 - Threads] DEBUG 
> o.a.h.i.c.DefaultClientConnectionOperator - Connecting to bar.com:81
> 12:18:46.465 [Camel (d-2) thread #7 - Threads] DEBUG 
> o.a.h.i.c.DefaultClientConnectionOperator - Connecting to example.com:81
> }}
> Port 81 is re-used also for route1. There are some workarounds for this:
> - the order of the route configuration is significant. If route2 was 
> configured before route1, everything would work ok
> - if we explicitly set port 80 in route1 (example.com:80), everything works 
> fine
> The DefaultClientConnectionOperator.openConnection() finds the port from the 
> registry.getScheme(target.getSchemeName()) which returns port 81. This is 
> used as default port if no port is set.
> The DefaultClientConnectionOperator is deprecated in 4.3, you may want to use 
> PoolingHttpClientConnectionManager (don't know if this solves the problem, 
> though).
> Or maybe this is not a Camel problem but a HttpClient bug?
> {quote}
> from("activemq:topic:foo")
> .routeId("route1")
> .threads()               
> .setHeader(HTTP_METHOD, constant("POST"))
> .to("http4://example.com");
> from("activemq:topic:foo")
> .routeId("route2")
> .threads()               
> .setHeader(HTTP_METHOD, constant("POST"))
> .to("http4://bar.com:81");
> {quote}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to