[ 
https://issues.apache.org/jira/browse/CAMEL-22920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18056251#comment-18056251
 ] 

Raymond commented on CAMEL-22920:
---------------------------------

I run it again and
{code:java}
from:
  uri: "direct:start"
  steps:
    - split:
        language:
          language: "simple"
          expression: "{{myExpression}}"
        steps:
          - to: "log:test?showBody=true"   {code}

I throught that 

 
{code:java}
{{myExpression}}{code}

Contained:


{code:java}
${body.split(',')}{code}

However it contained:


{code:java}
${header.someHeader} {code}

And someHeader container ${body.split(',')}. This lead to a double evaluation, 
which doesn't seem possible. 


I think EIP 
([https://camel.apache.org/components/next/languages/simple-language.html#_eip_examples)]
 only allow single evaluation:


{code:java}
<from uri="seda:orders">
   <filter>
       <simple>${header.foo}</simple>
       <to uri="mock:fooOrders"/>
   </filter>
</from>{code}

Maybe in 4.18.0 with nesting this is possible, or do it something like (xpath):


{code:java}
${simple(header.someHeader)} {code}

So not really an issue, but just not possible (yet)

> Kamelet property is not resolved in a split EIP
> -----------------------------------------------
>
>                 Key: CAMEL-22920
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22920
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-kamelet
>    Affects Versions: 4.17.0
>            Reporter: Raymond
>            Priority: Minor
>
> In a Kamelet, I have the following route:
> {code:java}
> from:
>   uri: "direct:start"
>   steps:
>     - split:
>         language:
>           language: "simple"
>           expression: "${body.split(',')}"
>         steps:
>           - to: "log:test?showBody=true"  {code}
> Sending the following message:
> {code:java}
> a,b,c {code}
> Gives the expected output:
>  
> {code:java}
> 2026-01-28T14:56:18.155+01:00  INFO 14240 --- [gateway] [tp801843081-712] 
> test                                     : Exchange[ExchangePattern: InOut, 
> BodyType: String, Body: a]
> 2026-01-28T14:56:18.161+01:00  INFO 14240 --- [gateway] [tp801843081-712] 
> test                                     : Exchange[ExchangePattern: InOut, 
> BodyType: String, Body: b]
> 2026-01-28T14:56:18.165+01:00  INFO 14240 --- [gateway] [tp801843081-712] 
> test                                     : Exchange[ExchangePattern: InOut, 
> BodyType: String, Body: c] {code}
> However, when I replace the expression with a Kamelet property \{{expression}}
> {code:java}
> from:
>   uri: "direct:start"
>   steps:
>     - split:
>         language:
>           language: "simple"
>           expression: "{{myExpression}}"
>         steps:
>           - to: "log:test?showBody=true"   {code}
> And the myExpression parameter value is: ${body.split(',')}
> Sending the same message, I get the following output:
> {code:java}
> 2026-01-28T14:46:26.461+01:00  INFO 46744 --- [gateway] [p1699750684-659] 
> test                                     : Exchange[ExchangePattern: InOut, 
> BodyType: String, Body: ${body.split(',')}]{code}
> In this case, it seems that the expression is treated like a constant, and 
> the expression is set as the body.
>  
>  



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

Reply via email to