Hi
Try without the quotes in the key
<camel:simple>${in.body.property[key]} == 'not
garrydias'</camel:simple>
On Fri, Aug 19, 2011 at 11:09 PM, garrydias <[email protected]> wrote:
> Hi folks
> it´s my scenario?:
>
> My body message is an instance of:
> *package foo;
> public class MyMessageObject
> {
> private Map<String, Serializable> property;
> // setter & gettter
> public String toString(){ return "toString called";}
> }*
>
> My xml is:
> <bean id="wireTapMock" class="bar.RoutingSpy"/>
> <camel:camelContext id="camelContext">
> <camel:endpoint id="endpointFileThen" uri="file://c:/dev/camel_then"
> />
> <camel:endpoint id="endpointFileOtherwise"
> uri="file://c:/dev/camel_otherwise" />
> <camel:route id="rout1">
> <camel:from ref="whatever" />
> <camel:convertBodyTo type="foo.MyMessageObject" />
> <camel:wireTap uri="bean:wireTapMock?method=execute"/>
> <camel:choice>
> <camel:when>
> <camel:simple>${in.body.property['key']} == 'not
> garrydias'</camel:simple>
> <camel:convertBodyTo type="java.lang.String" />
> <camel:to ref="endpointFileThen"/>
> </camel:when>
> <camel:otherwise>
> <camel:convertBodyTo type="java.lang.String" />
> <camel:to uri="endpointFileOtherwise" />
> </camel:otherwise>
> </camel:choice>
> </camel:route>
> </camel:context>
>
> wt hell my wire tap RoutingSpy.execute logs the MyMessageObject.property
> value as {key=garrydias} but the choice never goes to otherwise?
>
> I already tried:
> - invert the order in the logical test to force the cast of Serializable to
> String:
> 'not garrydias' == ${in.body.property['key']}
> - create a setHeader with ${in.body.property['key']} value an try
> <camel:simple>${in.header == 'not garrydias'</camel:simple>
> - cut off the single quotes
> <camel:simple>${in.body.property[key]} == 'not garrydias'</camel:simple>
>
> But wasn t solved
>
> I appreciate any help
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Choice-always-return-turn-in-first-test-tp4717029p4717029.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/