You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vadim Chekan <vc...@cox.net> on 2008/10/06 08:41:09 UTC

Choice operator

Folks,
Do you know what I'm missing here?

		from("timer://kickoff_5?period=10000").
		setHeader("a").constant("aa").setBody().constant("bbb").
		choice().when().el("in.headers['a'] == 'aa'").to("mock:true").
		otherwise().to("mock:false");


I see in the trace that the message on the choise input has required 
headers:

2008-10-06 06:37:04,418 [_5?period=10000] INFO  TraceInterceptor 
        - ID-ubuntu/52774-1223275024293/2-0 -> choice1 Choice[ [When[ 
elExpression[in.headers['a'] == 'aa'] -> [To[mock:true]]]] 
Otherwise[[To[mock:false]]]] InOnly 
Properties:{org.apache.camel.timer.name=kickoff_5, 
org.apache.camel.timer.firedTime=Mon Oct 06 06:37:04 GMT 2008, 
org.apache.camel.timer.period=10000} Headers:{a=aa, firedTime=Mon Oct 06 
06:37:04 GMT 2008} BodyType:String Body:bbb

Vadim.

RE: Choice operator

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

What about .equals as in regular Java?
in.headers['a'].equals('aa')



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Vadim Chekan [mailto:vchekan@cox.net] 
Sent: 9. oktober 2008 07:42
To: camel-user@activemq.apache.org
Subject: Re: Choice operator

You are right. Groovy worked.
choice().when().groovy("request.headers.a == 'aa'").to("mock:true").

Having single char in "el" did not work either. Even "1==1" is false. 
The only combination returning true in el is "true".

Vadim.

Claus Ibsen wrote:
> Hi
> 
> Could you try with a different expression language, maybe the el("in.headers['a'] == 'aa'") is not working correctly. Last time it was also a problem with two digit letters.
> 
> Can you try single letters such as:
> el("in.headers['a'] == 'a'")
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: Vadim Chekan [mailto:kot.begemot@gmail.com] 
> Sent: 7. oktober 2008 22:50
> To: camel-user@activemq.apache.org
> Subject: Re: Choice operator
> 
> I generate a message, set header 'a' to value 'aa' and than do a check
> "in.headers['a'] == 'aa'" and this check is false because message is
> routed to "mock:false" queue.
> I would expect it to go to "mock:true" destination.
> 
> On Sun, Oct 5, 2008 at 11:47 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>> Hi Vadim
>>
>> Sorry I don't get it. Could you elaborate what you see and what is missing?
>>
>>
>> Med venlig hilsen
>>
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> -----Original Message-----
>> From: Vadim Chekan [mailto:vchekan@cox.net]
>> Sent: 6. oktober 2008 08:41
>> To: camel-user@activemq.apache.org
>> Subject: Choice operator
>>
>> Folks,
>> Do you know what I'm missing here?
>>
>>                from("timer://kickoff_5?period=10000").
>>                setHeader("a").constant("aa").setBody().constant("bbb").
>>                choice().when().el("in.headers['a'] == 'aa'").to("mock:true").
>>                otherwise().to("mock:false");
>>
>>
>> I see in the trace that the message on the choise input has required
>> headers:
>>
>> 2008-10-06 06:37:04,418 [_5?period=10000] INFO  TraceInterceptor
>>        - ID-ubuntu/52774-1223275024293/2-0 -> choice1 Choice[ [When[
>> elExpression[in.headers['a'] == 'aa'] -> [To[mock:true]]]]
>> Otherwise[[To[mock:false]]]] InOnly
>> Properties:{org.apache.camel.timer.name=kickoff_5,
>> org.apache.camel.timer.firedTime=Mon Oct 06 06:37:04 GMT 2008,
>> org.apache.camel.timer.period=10000} Headers:{a=aa, firedTime=Mon Oct 06
>> 06:37:04 GMT 2008} BodyType:String Body:bbb
>>
>> Vadim.
>>
> 
> 
> 


Re: Choice operator

Posted by Vadim Chekan <vc...@cox.net>.
You are right. Groovy worked.
choice().when().groovy("request.headers.a == 'aa'").to("mock:true").

Having single char in "el" did not work either. Even "1==1" is false. 
The only combination returning true in el is "true".

Vadim.

Claus Ibsen wrote:
> Hi
> 
> Could you try with a different expression language, maybe the el("in.headers['a'] == 'aa'") is not working correctly. Last time it was also a problem with two digit letters.
> 
> Can you try single letters such as:
> el("in.headers['a'] == 'a'")
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: Vadim Chekan [mailto:kot.begemot@gmail.com] 
> Sent: 7. oktober 2008 22:50
> To: camel-user@activemq.apache.org
> Subject: Re: Choice operator
> 
> I generate a message, set header 'a' to value 'aa' and than do a check
> "in.headers['a'] == 'aa'" and this check is false because message is
> routed to "mock:false" queue.
> I would expect it to go to "mock:true" destination.
> 
> On Sun, Oct 5, 2008 at 11:47 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:
>> Hi Vadim
>>
>> Sorry I don't get it. Could you elaborate what you see and what is missing?
>>
>>
>> Med venlig hilsen
>>
>> Claus Ibsen
>> ......................................
>> Silverbullet
>> Skovsgårdsvænget 21
>> 8362 Hørning
>> Tlf. +45 2962 7576
>> Web: www.silverbullet.dk
>> -----Original Message-----
>> From: Vadim Chekan [mailto:vchekan@cox.net]
>> Sent: 6. oktober 2008 08:41
>> To: camel-user@activemq.apache.org
>> Subject: Choice operator
>>
>> Folks,
>> Do you know what I'm missing here?
>>
>>                from("timer://kickoff_5?period=10000").
>>                setHeader("a").constant("aa").setBody().constant("bbb").
>>                choice().when().el("in.headers['a'] == 'aa'").to("mock:true").
>>                otherwise().to("mock:false");
>>
>>
>> I see in the trace that the message on the choise input has required
>> headers:
>>
>> 2008-10-06 06:37:04,418 [_5?period=10000] INFO  TraceInterceptor
>>        - ID-ubuntu/52774-1223275024293/2-0 -> choice1 Choice[ [When[
>> elExpression[in.headers['a'] == 'aa'] -> [To[mock:true]]]]
>> Otherwise[[To[mock:false]]]] InOnly
>> Properties:{org.apache.camel.timer.name=kickoff_5,
>> org.apache.camel.timer.firedTime=Mon Oct 06 06:37:04 GMT 2008,
>> org.apache.camel.timer.period=10000} Headers:{a=aa, firedTime=Mon Oct 06
>> 06:37:04 GMT 2008} BodyType:String Body:bbb
>>
>> Vadim.
>>
> 
> 
> 


RE: Choice operator

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi

Could you try with a different expression language, maybe the el("in.headers['a'] == 'aa'") is not working correctly. Last time it was also a problem with two digit letters.

Can you try single letters such as:
el("in.headers['a'] == 'a'")


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Vadim Chekan [mailto:kot.begemot@gmail.com] 
Sent: 7. oktober 2008 22:50
To: camel-user@activemq.apache.org
Subject: Re: Choice operator

I generate a message, set header 'a' to value 'aa' and than do a check
"in.headers['a'] == 'aa'" and this check is false because message is
routed to "mock:false" queue.
I would expect it to go to "mock:true" destination.

On Sun, Oct 5, 2008 at 11:47 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:
> Hi Vadim
>
> Sorry I don't get it. Could you elaborate what you see and what is missing?
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Vadim Chekan [mailto:vchekan@cox.net]
> Sent: 6. oktober 2008 08:41
> To: camel-user@activemq.apache.org
> Subject: Choice operator
>
> Folks,
> Do you know what I'm missing here?
>
>                from("timer://kickoff_5?period=10000").
>                setHeader("a").constant("aa").setBody().constant("bbb").
>                choice().when().el("in.headers['a'] == 'aa'").to("mock:true").
>                otherwise().to("mock:false");
>
>
> I see in the trace that the message on the choise input has required
> headers:
>
> 2008-10-06 06:37:04,418 [_5?period=10000] INFO  TraceInterceptor
>        - ID-ubuntu/52774-1223275024293/2-0 -> choice1 Choice[ [When[
> elExpression[in.headers['a'] == 'aa'] -> [To[mock:true]]]]
> Otherwise[[To[mock:false]]]] InOnly
> Properties:{org.apache.camel.timer.name=kickoff_5,
> org.apache.camel.timer.firedTime=Mon Oct 06 06:37:04 GMT 2008,
> org.apache.camel.timer.period=10000} Headers:{a=aa, firedTime=Mon Oct 06
> 06:37:04 GMT 2008} BodyType:String Body:bbb
>
> Vadim.
>



-- 
>From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified

Re: Choice operator

Posted by Vadim Chekan <ko...@gmail.com>.
I generate a message, set header 'a' to value 'aa' and than do a check
"in.headers['a'] == 'aa'" and this check is false because message is
routed to "mock:false" queue.
I would expect it to go to "mock:true" destination.

On Sun, Oct 5, 2008 at 11:47 PM, Claus Ibsen <ci...@silverbullet.dk> wrote:
> Hi Vadim
>
> Sorry I don't get it. Could you elaborate what you see and what is missing?
>
>
> Med venlig hilsen
>
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Vadim Chekan [mailto:vchekan@cox.net]
> Sent: 6. oktober 2008 08:41
> To: camel-user@activemq.apache.org
> Subject: Choice operator
>
> Folks,
> Do you know what I'm missing here?
>
>                from("timer://kickoff_5?period=10000").
>                setHeader("a").constant("aa").setBody().constant("bbb").
>                choice().when().el("in.headers['a'] == 'aa'").to("mock:true").
>                otherwise().to("mock:false");
>
>
> I see in the trace that the message on the choise input has required
> headers:
>
> 2008-10-06 06:37:04,418 [_5?period=10000] INFO  TraceInterceptor
>        - ID-ubuntu/52774-1223275024293/2-0 -> choice1 Choice[ [When[
> elExpression[in.headers['a'] == 'aa'] -> [To[mock:true]]]]
> Otherwise[[To[mock:false]]]] InOnly
> Properties:{org.apache.camel.timer.name=kickoff_5,
> org.apache.camel.timer.firedTime=Mon Oct 06 06:37:04 GMT 2008,
> org.apache.camel.timer.period=10000} Headers:{a=aa, firedTime=Mon Oct 06
> 06:37:04 GMT 2008} BodyType:String Body:bbb
>
> Vadim.
>



-- 
>From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified

RE: Choice operator

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Vadim

Sorry I don't get it. Could you elaborate what you see and what is missing?


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Vadim Chekan [mailto:vchekan@cox.net] 
Sent: 6. oktober 2008 08:41
To: camel-user@activemq.apache.org
Subject: Choice operator

Folks,
Do you know what I'm missing here?

		from("timer://kickoff_5?period=10000").
		setHeader("a").constant("aa").setBody().constant("bbb").
		choice().when().el("in.headers['a'] == 'aa'").to("mock:true").
		otherwise().to("mock:false");


I see in the trace that the message on the choise input has required 
headers:

2008-10-06 06:37:04,418 [_5?period=10000] INFO  TraceInterceptor 
        - ID-ubuntu/52774-1223275024293/2-0 -> choice1 Choice[ [When[ 
elExpression[in.headers['a'] == 'aa'] -> [To[mock:true]]]] 
Otherwise[[To[mock:false]]]] InOnly 
Properties:{org.apache.camel.timer.name=kickoff_5, 
org.apache.camel.timer.firedTime=Mon Oct 06 06:37:04 GMT 2008, 
org.apache.camel.timer.period=10000} Headers:{a=aa, firedTime=Mon Oct 06 
06:37:04 GMT 2008} BodyType:String Body:bbb

Vadim.