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

Set the ExchangePattern with a routeTemplate

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.19.0
    • 3.18.3, 3.20.0
    • camel-core, eip
    • None
    • Unknown

    Description

      I would like to set the ExchangePattern dynamically with a routetemplate like this:

      routeTemplate("setPattern")
          .templateParameter("in")
          .templateParameter("out")
          .templateParameter("exchangePattern")
          .from("{{in}}")
              .setExchangePattern("{{myExchangePattern}}")
              .to("{{out}}");

      This is currently not possible as template parameters expect only Strings. I tried to work around it. For example:

       

      .setExchangePattern("ExchangePattern.valueOf({{myExchangePattern}})")
      
      //or
      .setProperty("ExchangePattern").simple("${exchange.setPattern('{{ExchangePattern}}')}")
       
      

      But they don't work because the parameter are interpolated too late in the process. For now, I set a property and use processor to set the ExchangePattern.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            skin27 Raymond
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: