Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apache camel simple expression not giving string value

I am using apache camel. I am trying to retrieve value from body using simple expression language. I need it as a String but simple returns SimpleBuilder object. So I have tried something like this

simple("${body.address.line}").resultType(String.class).getResultType()

but it is returning me java.lang.String. please tell me how can I get this expression's result as String?

like image 389
LowCool Avatar asked Jun 05 '26 01:06

LowCool


2 Answers

That is only for configuring the simple expression. If you need to evaluate it then call the evaluate method

String foo = simple("${body.address.line}").evaluate(exchange, String.class);
like image 66
Claus Ibsen Avatar answered Jun 07 '26 23:06

Claus Ibsen


Using xml, we can simply evaluate using

<simple>${body.address.line}</simple>
like image 37
KayV Avatar answered Jun 07 '26 23:06

KayV



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!