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

http4 does not recognize part of URI provided with header

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.24.1
    • None
    • camel-http4
    • None
    • Unknown

    Description

      I'm trying to describe a route with Enrich EIP. It should be done as:

      1) template producer gives an year (2019, 2012 etc), set it in header and push the message into route

      2) from that endpoint message should be enriched from URI composed by template:

      from("seda:calendar-update-process")
              .setHeader("calendar-uri", simple("xmlcalendar.ru/data/ru/${header["+HEADER_YEAR+"]}/calendar.xml"))
              .log(LoggingLevel.WARN, log, "Updating calendar from url: ${header.calendar-uri}")
              .enrich("http4:$\\{header.calendar-uri\\}", (oldExchange, newExchange) -> {
                  oldExchange.getIn().setBody(newExchange.getIn().getBody());
                  return oldExchange;
              })
      
      

      as described on https://camel.apache.org/manual/latest/content-enricher.html in part named 'Using dynamic uris'

       

      But it cannot parse that expression. I get an error:

       

      org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: http4://$%5C%7Bheader.calendar-uri%5C%7D due to: Expected scheme-specific part at index 6: http4:
      	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:753)
      	at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80)
      	at org.apache.camel.util.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:91)
      	at org.apache.camel.processor.Enricher.resolveEndpoint(Enricher.java:299)
      	at org.apache.camel.processor.Enricher.process(Enricher.java:165)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298)
      	at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:210)
      	at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:155)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.net.URISyntaxException: Expected scheme-specific part at index 6: http4:
      	at java.net.URI$Parser.fail(URI.java:2848)
      	at java.net.URI$Parser.failExpecting(URI.java:2854)
      	at java.net.URI$Parser.parse(URI.java:3057)
      	at java.net.URI.<init>(URI.java:673)
      	at org.apache.camel.component.http4.HttpComponent.createEndpoint(HttpComponent.java:269)
      	at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:130)
      	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:706)
      	... 15 common frames omitted
      

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            bvn13 Vyacheslav Boyko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: