You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Josef Tember (Jira)" <ji...@apache.org> on 2021/02/16 08:33:00 UTC

[jira] [Created] (CAMEL-16216) Dynamic Endpoint with Http-Component not working

Josef Tember created CAMEL-16216:
------------------------------------

             Summary: Dynamic Endpoint with Http-Component not working
                 Key: CAMEL-16216
                 URL: https://issues.apache.org/jira/browse/CAMEL-16216
             Project: Camel
          Issue Type: Bug
          Components: camel-http
    Affects Versions: 3.8.0, 3.7.2, 3.7.0, 3.6.0
            Reporter: Josef Tember


I created a ticket: reffering to

http://mail-archives.apache.org/mod_mbox/camel-users/202102.mbox/%3CCAGB5yN%3Dv0PZSTEPvEO0O6i2CRZMO1YiF4X9e%3DwNZsmLROJYiTQ%40mail.gmail.com%3E

 

Also tried it with Version 3.6.0, 3.7.0, 3.7.2, 3.8.0


I'm trying to make an http-call with dynamic timeout, passed by header
{code:java}
Map<String,Object> headerMap=new HashMap<>();
headerMap.put(Exchange.HTTP_URI, "http://myserver.example.com");
headerMap.put("timeout", 5000);
main.getCamelTemplate().sendBodyAndHeaders("direct:test_http_dynamic",null,headerMap);{code}
the endpoint looks like this:

 
{code:java}
from("direct:test_http_dynamic")
 .toD("http:test.dyn?socketTimeout=${in.header.timeout}");{code}
This leads to this Stacktrace:
{code:java}
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: http://http:test.dyn
due to: Failed to resolve endpoint: http://http:test.dyn due to: The uri part is not configured
correctly. You have duplicated the http(s) protocol.
 at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:912)
~[camel-base-engine-3.7.0.jar:3.7.0]
 at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:798)
~[camel-base-engine-3.7.0.jar:3.7.0]
 at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:73)
~[camel-support-3.7.0.jar:3.7.0]
 at org.apache.camel.support.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:112)
~[camel-support-3.7.0.jar:3.7.0]{code}
 

=== Possible Workaround:

change RouteDefinition to - turning off optimizer:

 
{code:java}
from("direct:test_http_dynamic_workaround")
.toD().allowOptimisedComponents(false).cacheSize(10).uri("http:test.dyn?socketTimeout=${in.header.timeout}");

{code}
 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)