Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16216

Dynamic Endpoint with Http-Component not working

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Information Provided
    • Affects Version/s: 3.6.0, 3.7.0, 3.7.2, 3.8.0
    • Fix Version/s: None
    • Component/s: camel-http
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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

      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);

      the endpoint looks like this:

       

      from("direct:test_http_dynamic")
       .toD("http:test.dyn?socketTimeout=${in.header.timeout}");

      This leads to this Stacktrace:

      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]

       

      === Possible Workaround:

      change RouteDefinition to - turning off optimizer:

       

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

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              temberjosef Josef Tember
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: