You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by heinrichheine <ma...@vitaphone.de> on 2011/09/29 12:52:31 UTC

Where is the .handled method? Migrating from 2.5 to 2.8.1

Hi,
i currently migrating my Camel Java DSL route from Camel 2.5 to 2.8.1
and i figured out, that in the onException clause, there is no
.handled(true) method anymore.
Where is it gone or how should i mark my messages as handled now?

Thanks

 martin

--
View this message in context: http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852597.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Where is the .handled method? Migrating from 2.5 to 2.8.1

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 29, 2011 at 1:18 PM, heinrichheine
<ma...@vitaphone.de> wrote:
> And a general question regarding the wireTap situation:
>
> i found some other locations, e.g. choice where i can not place a wireTap
> inside a when and place a second when afterwards.
>
> Example
>
> .choice()
>   .when().xpath("expr")
>       .wireTap("log:somewhere")
>       .to("direct:here")
>   .when()           <-------------- this creates a compile error
>      .wireTap("log:somwherelese")
>      .to("direct:there")
> .endChoice()
>
> Why am i not allowed to use wireTap in this situation?
>

You need to end the wireTap as it has sub configuration now in Camel 2.8 onwards

For example like this:
                from("direct:start")
                    .choice()
                        .when(body().contains("Camel"))
                            .wireTap("mock:camel").end()
                        .when(body().contains("Donkey"))
                            .wireTap("mock:donkey").copy().end()
                        .otherwise()
                            .to("mock:other");


>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852665.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, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Where is the .handled method? Migrating from 2.5 to 2.8.1

Posted by heinrichheine <ma...@vitaphone.de>.
And a general question regarding the wireTap situation:

i found some other locations, e.g. choice where i can not place a wireTap
inside a when and place a second when afterwards.

Example

.choice()
   .when().xpath("expr")
       .wireTap("log:somewhere")
       .to("direct:here")
   .when()           <-------------- this creates a compile error
      .wireTap("log:somwherelese")
      .to("direct:there")
.endChoice()

Why am i not allowed to use wireTap in this situation?


--
View this message in context: http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852665.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Where is the .handled method? Migrating from 2.5 to 2.8.1

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 29, 2011 at 1:11 PM, heinrichheine
<ma...@vitaphone.de> wrote:
> Ah,
> yes its still there but the location must be changed.
> My 2.5 code:
>        route.onException( ExchangeTimedOutException.class )
>            .setHeader( "incomingroute", constant(config.getRouteName()) )
>            .wireTap( DEAD_LETTER )
>            .setHeader( RoutingConstants.RESULT_CODE, constant(
> ResponseCodes.RESPONSE_SERVER_BUSY.getCode() ) )
>            .setHeader( RoutingConstants.RESULT_TEXT, simple( "${property."
> + ResponseCodes.RESPONSE_SERVER_BUSY.property() + "}" ) )
>            .handled( true )
>            .to( directResponse )
>            .stop()
>
> The handled is not allowed to be placed after a wireTap call.
>
>        route.onException( ExchangeTimedOutException.class )
>            .setHeader( "incomingroute", constant(config.getRouteName()) )
>            .handled( true )
>            .wireTap( DEAD_LETTER )
>            .setHeader( RoutingConstants.RESULT_CODE, constant(
> ResponseCodes.RESPONSE_SERVER_BUSY.getCode() ) )
>            .setHeader( RoutingConstants.RESULT_TEXT, simple( "${property."
> + ResponseCodes.RESPONSE_SERVER_BUSY.property() + "}" ) )
>            .to( directResponse )
>            .stop()
> This compiles
>

Yeah handled(true) has to be in the top in the onException.


>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Sep 29, 2011 at 12:52 PM, heinrichheine
>> &lt;martin.heinemann@&gt; wrote:
>>> Hi,
>>> i currently migrating my Camel Java DSL route from Camel 2.5 to 2.8.1
>>> and i figured out, that in the onException clause, there is no
>>> .handled(true) method anymore.
>>> Where is it gone or how should i mark my messages as handled now?
>>>
>>
>> It should still be there on onException.
>>
>> Can you post the code with the problem?
>>
>>
>>> Thanks
>>>
>>>  martin
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852597.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852647.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, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Where is the .handled method? Migrating from 2.5 to 2.8.1

Posted by heinrichheine <ma...@vitaphone.de>.
Ah, 
yes its still there but the location must be changed.
My 2.5 code:
        route.onException( ExchangeTimedOutException.class )
            .setHeader( "incomingroute", constant(config.getRouteName()) )
            .wireTap( DEAD_LETTER )
            .setHeader( RoutingConstants.RESULT_CODE, constant(
ResponseCodes.RESPONSE_SERVER_BUSY.getCode() ) )
            .setHeader( RoutingConstants.RESULT_TEXT, simple( "${property."
+ ResponseCodes.RESPONSE_SERVER_BUSY.property() + "}" ) )
            .handled( true )
            .to( directResponse )
            .stop()

The handled is not allowed to be placed after a wireTap call. 

        route.onException( ExchangeTimedOutException.class )
            .setHeader( "incomingroute", constant(config.getRouteName()) )
            .handled( true )
            .wireTap( DEAD_LETTER )
            .setHeader( RoutingConstants.RESULT_CODE, constant(
ResponseCodes.RESPONSE_SERVER_BUSY.getCode() ) )
            .setHeader( RoutingConstants.RESULT_TEXT, simple( "${property."
+ ResponseCodes.RESPONSE_SERVER_BUSY.property() + "}" ) )
            .to( directResponse )
            .stop()
This compiles


Claus Ibsen-2 wrote:
> 
> On Thu, Sep 29, 2011 at 12:52 PM, heinrichheine
> &lt;martin.heinemann@&gt; wrote:
>> Hi,
>> i currently migrating my Camel Java DSL route from Camel 2.5 to 2.8.1
>> and i figured out, that in the onException clause, there is no
>> .handled(true) method anymore.
>> Where is it gone or how should i mark my messages as handled now?
>>
> 
> It should still be there on onException.
> 
> Can you post the code with the problem?
> 
> 
>> Thanks
>>
>>  martin
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852597.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
> 


--
View this message in context: http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852647.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Where is the .handled method? Migrating from 2.5 to 2.8.1

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 29, 2011 at 12:52 PM, heinrichheine
<ma...@vitaphone.de> wrote:
> Hi,
> i currently migrating my Camel Java DSL route from Camel 2.5 to 2.8.1
> and i figured out, that in the onException clause, there is no
> .handled(true) method anymore.
> Where is it gone or how should i mark my messages as handled now?
>

It should still be there on onException.

Can you post the code with the problem?


> Thanks
>
>  martin
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Where-is-the-handled-method-Migrating-from-2-5-to-2-8-1-tp4852597p4852597.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, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/