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:04:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=17985275#comment-17985275 ] 

Claus Ibsen commented on CAMEL-22190:
-------------------------------------

This is not really intended there - you can't use \{{ }} everywhere.

> 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: Bug
>          Components: camel-kamelet-main
>    Affects Versions: 4.12.0
>            Reporter: Raymond
>            Priority: Minor
>
> 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)