Ok, understand. 

Thanks.

-----Original Message-----
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Friday, November 16, 2012 4:46 PM
To: users@camel.apache.org
Subject: Re: Problem of Intercept with When Condition

On Fri, Nov 16, 2012 at 8:52 AM, liugang <clevers...@gmail.com> wrote:
> Hi Claus:
>
> Ah, ok, if so, then no problem.
> But from the code, user can write everything what he wants, there's no any
> hint to indicate that. May be it's better to improve it.
>

Thats not really possible as we have stretched how far you can take
plain Java language as a DSL.

And if you follow the documentation then you get it correct. And if
you follow common sense.

eg I want to intercept WHEN x == 5


>
> Thanks
> GangLiu
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Friday, November 16, 2012 3:49 PM
> To: users@camel.apache.org
> Subject: Re: Problem of Intercept with When Condition
>
> On Fri, Nov 16, 2012 at 8:01 AM, liugang <clevers...@gmail.com> wrote:
>> Hi Willem:
>>
>> Yes, if you add the "when" close to the "intercept", there's no problem.
>>
>> But if add some more between them, for example:
>>         Intercept().process(processor).when(....).to(...);
>>
>> Then you will see the problem.
>>
>
> The when *must* be right after the intercept!
>
>> Please have a try.
>>
>> Thanks
>> GangLiu
>>
>> -----Original Message-----
>> From: Willem jiang [mailto:willem.ji...@gmail.com]
>> Sent: Friday, November 16, 2012 2:53 PM
>> To: users@camel.apache.org
>> Subject: Re: Problem of Intercept with When Condition
>>
>> Hi,
>>
>> I just did a quick test on camel trunk, I cannot reproduce the error that
> you get.
>> You can check out the unit test here[1].
>>
>>
>
[1]https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org
> /apache/camel/processor/intercept/InterceptSimpleRouteWhenTest.java
>>
>> --
>> Willem Jiang
>>
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Web: http://www.fusesource.com | http://www.redhat.com
>> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
> (English)
>>           http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
>> Twitter: willemjiang
>> Weibo: willemjiang
>>
>>
>>
>>
>>
>> On Friday, November 16, 2012 at 2:07 PM, liugang wrote:
>>
>>> Hi All:
>>>
>>>
>>> I have following codes:
>>>
>>> intercept().process(new Processor() {
>>>
>>>
>>> public void process(Exchange
>>> exchange) throws Exception {
>>>
>>> System.out.println("Intercept without condition");
>>>
>>> }
>>>
>>> }).when(simple("${in.body} ==
>>> 'a'")).process(new Processor() {
>>>
>>>
>>> public void process(Exchange
>>> exchange) throws Exception {
>>>
>>> System.out.println("Intercept when body equals 'a'");
>>>
>>> }
>>>
>>> });
>>>
>>> from("timer:foo?repeatCount=1").setBody(constant("b")).process(
>>>
>>> new Processor() {
>>>
>>>
>>> public void
>>> process(Exchange exchange)
>>>
>>> throws Exception {
>>>
>>> System.out.println(exchange.getIn().getBody(
>>>
>>> String.class));
>>>
>>> }
>>>
>>> });
>>>
>>>
>>> The result is:
>>>
>>>
>>> Intercept without condition
>>>
>>> Intercept when body equals 'a'
>>>
>>> Intercept without condition
>>>
>>> Intercept when body equals 'a'
>>>
>>> b
>>>
>>>
>>> But I think the correct one should be:
>>>
>>>
>>> Intercept without condition
>>>
>>> Intercept without condition
>>>
>>> b
>>>
>>>
>>> and if I move the when condition to next behind the intercept(), then it
>>> works fine.
>>>
>>>
>>> Does anybody can have a look, and check it's a Camel bug or not?
>>>
>>>
>>> Thanks
>>>
>>> GangLiu
>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to