camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Changing POJO attribute from the body using the Simple Expression Language
Date Sat, 23 Feb 2013 16:05:17 GMT
I logged a ticket about adding <script> to the DSL
https://issues.apache.org/jira/browse/CAMEL-6098

On Sat, Feb 23, 2013 at 5:01 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> On Thu, Feb 21, 2013 at 6:23 PM, gilboy <josephotoole@gmail.com> wrote:
>> Hi
>>
>> Assuming my ${body} is of type Account.
>>
>> I want to set the accountId property on this object in my route using Simple
>> expression langauge. Is this possible as  I cannot find any examples
>>
>
> Yeah we do not have a noop script in the DSL, though you can still
> invoke methods and pass in parameters from the XML DSL.
>
> If you invoke a method that is void, then there is no side effect when
> using <setBody> or <transform>
>
> So you can call the method and pass in a parameter.
> <setBody><simple>${body.setAccountId(123)}</simple></setBody>
>
> For example if the id is from a header you can do
> <setBody><simple>${body.setAccountId(${header.myId})}</simple></setBody>
>
> Though it would be nice to have a <script> in the DSL
>
> <script>
>   <simple>
>    ...
>   </simple>
> </script>
>
> Or to invoke some groovy script
> <script>
>   <groovy>
>    ...
>   </groovy>
> </script>
>
>
> And alternative is also the language endpoint so you can do
> http://camel.apache.org/language
>
> <to uri="language:simple:${body.setAccountId(${header.myId})}"/>
>
>
>
>> Thanks
>> Joe
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Changing-POJO-attribute-from-the-body-using-the-Simple-Expression-Language-tp5727971.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message