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

Service call definition - Simple language expresion in uri is not being evaluated

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.20.1
    • Fix Version/s: 2.20.2, 2.21.0
    • Component/s: camel-core
    • Labels:
      None
    • Environment:

      Spring boot

    • Estimated Complexity:
      Unknown

      Description

      I'm facing some problems with service call definition.

      A route is supposed to send some get requests to a specific endpoint. The endpoint requires a parameter in the url path -

      GET <host>:<port>/api/.../<id>

      Route definition:

        routebuilder.from("direct:getSomeEntity")
      	.setHeader(Exchange.HTTP_METHOD, constant(HttpMethod.GET))
      	.serviceCall()
      	.name("test")
      	.uri("test/api/.../${fid}")
      	.end()
              ...
      

      This route did not work and the

      ${fid}

      parameter was never resolved despite the javadoc states that the uri may contain simple language expressions

      See -

      https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/model/cloud/ServiceCallDefinition.java#L187

      Route execution:

      camelContext.createFluentProducerTemplate()
      	.withHeader("fid", id)
      	.to("direct:getSomeEntity")
              ...
      

      Eventually i got it work with following workaround

      .serviceCall()
      	.name("test")
      	.expression()		
      	.simple("http4://${header.CamelServiceCallServiceHost}:${header.CamelServiceCallServicePort}/api/.../${fid}")
      	.end()
      
      

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              xcvljk Frantisek Sichinger
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: