Hi,

I just went through the camel-groovy code and wrote some test code, I don't think the attribut() DSL is working out of box.

Please feel free to create a JIRA[1] for it.
[1]https://issues.apache.org/activemq/browse/CAMEL

Willem

Olivier Roger wrote:
Hello Camel,

I had a question about the attributes that can be added in the expression as
explained with $user in: http://camel.apache.org/groovy.html

Attributes

You can add your own attributes with the attribute(name, value) DSL
method, such as:

In the sample below we add an attribute user that is an object we already
have instantiated as myUser. This object has a getFirstName() method that we want to set as header on the message. We use the groovy language to concat the first and last name into a single string
that is returned.

from("direct:in").setHeader("name").groovy("'$user.firstName
$user.lastName'").attribute("user", myUser").to("seda:users");

If I got this right, the user bean is dependent to the message payload.
Otherwise every message would have the same name.

I was wondering how I could instantiate that bean. I could not find
information about that in the online documentation. I would also like to use
it with Spring DSL.

Any help on this would be welcome,

Thanks in advance

Olivier

Reply via email to