You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by simeon667 <si...@gmail.com> on 2010/10/29 20:15:22 UTC

Simple


Hi there,

I seem to have some basic understanding problem of Simple evaluations and it
looks like I'm done searching the official docs without any success. Help
appreciated.

Code:

1 from("timer://twoSecTimer?fixedRate=true&period=60000")
2                .to("sql:select * from messages?dataSourceRef=myDS")
3                .split(body())
4                .to("log:org.apache.camel?level=DEBUG")
5                .setHeader("partnerName",
ExpressionBuilder.simpleExpression("${body[name]}"))
6               
.enrich("restlet:http://localhost:8081/PartnerStatus/resources/partnerStatus/{partnerName}?restletMethod=get",
new PartnerStatusAggregationStrategy())
7                .to("log:org.apache.camel?level=DEBUG");

The query results in an Exchange like this:

Exchange[BodyType:java.util.LinkedHashMap, Body:{id=0, sender=Sting,
severity=0, message=Desert Rose, received=2010-10-29 13:08:14.0}]

1. Question: Why does line 5 result in ExpressionIllegalSyntaxException:
Illegal syntax: body[name]. The body is a map, so why can't I lookup a value
by [key]?

2. Question: Why doesn't the Simple expression in line 6
(...{partnerName}...) get substituted. No matter if I prepend a $ - it
doesn't. I did fix the issue from Question 1 by putting a constant as a
header value - no success ...

Thanks in advance!

Best,
Simeon



-- 
View this message in context: http://camel.465427.n5.nabble.com/Simple-tp3242568p3242568.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Simple

Posted by Claus Ibsen <cl...@gmail.com>.
Ad 2)
Try with Camel 2.5 I think its fixed in that version.


On Fri, Oct 29, 2010 at 8:15 PM, simeon667 <si...@gmail.com> wrote:
>
>
> Hi there,
>
> I seem to have some basic understanding problem of Simple evaluations and it
> looks like I'm done searching the official docs without any success. Help
> appreciated.
>
> Code:
>
> 1 from("timer://twoSecTimer?fixedRate=true&period=60000")
> 2                .to("sql:select * from messages?dataSourceRef=myDS")
> 3                .split(body())
> 4                .to("log:org.apache.camel?level=DEBUG")
> 5                .setHeader("partnerName",
> ExpressionBuilder.simpleExpression("${body[name]}"))
> 6
> .enrich("restlet:http://localhost:8081/PartnerStatus/resources/partnerStatus/{partnerName}?restletMethod=get",
> new PartnerStatusAggregationStrategy())
> 7                .to("log:org.apache.camel?level=DEBUG");
>
> The query results in an Exchange like this:
>
> Exchange[BodyType:java.util.LinkedHashMap, Body:{id=0, sender=Sting,
> severity=0, message=Desert Rose, received=2010-10-29 13:08:14.0}]
>
> 1. Question: Why does line 5 result in ExpressionIllegalSyntaxException:
> Illegal syntax: body[name]. The body is a map, so why can't I lookup a value
> by [key]?
>
> 2. Question: Why doesn't the Simple expression in line 6
> (...{partnerName}...) get substituted. No matter if I prepend a $ - it
> doesn't. I did fix the issue from Question 1 by putting a constant as a
> header value - no success ...
>
> Thanks in advance!
>
> Best,
> Simeon
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Simple-tp3242568p3242568.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Simple

Posted by simeon667 <si...@gmail.com>.
It should read ${body[name]} in line 5.
-- 
View this message in context: http://camel.465427.n5.nabble.com/Simple-tp3242568p3242571.html
Sent from the Camel - Users mailing list archive at Nabble.com.