You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2025/06/23 10:19:00 UTC

[jira] [Resolved] (CAMEL-22190) Can't use language as parameter in a Kamelet

     [ https://issues.apache.org/jira/browse/CAMEL-22190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-22190.
---------------------------------
    Resolution: Fixed

> Can't use language as parameter in a Kamelet
> --------------------------------------------
>
>                 Key: CAMEL-22190
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22190
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core, dsl
>    Affects Versions: 4.12.0
>            Reporter: Raymond
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.13.0
>
>
> When I use setBody in a Kamelet like this:
> {code:java}
> - setBody:
>               language:
>                 language: "groovy" # Hardcoded language
>                 expression: "{{content}}"{code}
> I get a proper response. However, because the language is user-defined I tried to set a parameter dynamically:
> {code:java}
>           - setBody:
>               language:
>                 language: "{{language}}" # Attempting to use a dynamic parameter
>                 expression: "{{content}}" {code}
> Though language is a String, it seems not allowed, because the parameter isn't interpolated like for example expression, so I get:
> {code:java}
> "Failed to create route setbody-test at: >>> SetBody[{{language}}{{{content}}}] <<< in route: Route(bodytest3-2)[From[{{in}}] -> [SetBody[{{language}}{{{c... because of No language could be found for: {{language}}"  {code}
> I try to avoid workarounds like multiple Kamelets for each language, or have a choice with multiple languages in it.
> Note that this issue occurs in other EIP's like split, filter, setHeaders as well. I just took setBody as example.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)