Hi and welcome

You don't say what myEval does, but the following expression does what you
want.

INSERT INTO SOMETHING (${body[VALUE_ONE]},${body[VALUE_TWO]})

Taariq

On Fri, Dec 5, 2014 at 1:51 AM, welshstew <stuart.winches...@gmail.com>
wrote:

> Long time lurker - first time poster!  Please be nice :)
>
> I have a very simple camel route:
>
> <from uri="timer://foo?period=1000&amp;repeatCount=1" />
>       <process ref="populateMap" />
>       <log message="SIMPLE SPRING: INSERT INTO SOMETHING
>
> (${bean:myeval?method=eval(${body[VALUE_ONE]})},${bean:myeval?method=eval(${body[VALUE_TWO]})})"
> />
>       <process ref="simpleExpProcessor"/>
>       <log message="${body}" />
>       <log message="EXPECTED: INSERT INTO SOMETHING ('value','Thing (with
> brackets)')" />
>
> The populateMap bean creates a map as follows:
>
> LinkedHashMap<String,Object> map = new LinkedHashMap<String, Object>();
> map.put("VALUE_ONE", "'value'");
> map.put("VALUE_TWO", "'Thing (with brackets)'");
>
> The log output is:
>
> [pache.camel.spring.Main.main()] SpringCamelContext             INFO
> Apache
> Camel 2.13.3 (CamelContext: camel-1) started in 0.282 seconds
> [mel-1) thread #0 - timer://foo] MyEvaluator                    DEBUG
> evaluated : value
> [mel-1) thread #0 - timer://foo] MyEvaluator                    DEBUG
> evaluated : 'Thing (with brackets
> [mel-1) thread #0 - timer://foo] route1                         INFO
> SIMPLE
> SPRING: INSERT INTO SOMETHING (value,'Thing (with brackets)
> [mel-1) thread #0 - timer://foo] SimpleExpressionProcessor      DEBUG
> INSERT
> INTO SOMETHING
>
> (${bean:myeval?method=eval(${body[VALUE_ONE]})},${bean:myeval?method=eval(${body[VALUE_TWO]})})
> [mel-1) thread #0 - timer://foo] MyEvaluator                    DEBUG
> evaluated : value
> [mel-1) thread #0 - timer://foo] MyEvaluator                    DEBUG
> evaluated : 'Thing (with brackets
> [mel-1) thread #0 - timer://foo] route1                         INFO
> INSERT
> INTO SOMETHING (value,'Thing (with brackets)
> [mel-1) thread #0 - timer://foo] route1                         INFO
> EXPECTED: INSERT INTO SOMETHING ('value','Thing (with brackets)')
>
> Am I using the simple expression in the wrong way?  As you may expect I am
> attempting to build SQL queries/inserts using simple and the results are
> not
> quite as expected.
>
> Many Thanks,
>
> Stu.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Unexpected-behaviour-of-Camel-Simple-expression-tp5760163.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to