You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jens <sm...@dzbank.de> on 2012/05/29 16:19:46 UTC

doTry/doCatch with original message

Hi list,

I'm trying to route a message to a SOAP service via a CXF endpoint like
this:

from("cxf:bean:...").
  doTry().
    to("cxf:bean:primary").

  doCatch(IOException.class).
    to("cxf:bean:secondary").

  end();

So basically, send the message to the first service, and if that doesn't
work, send it to the second instead. Unfortunately, when the catch block is
triggered the message body is null so routing to the secondary endpoint
fails, too. Is there a way to get the original message body back, or do I
need to save/restore it myself somehow?

Interestingly, using onException() does not seem to show the same problem.

Thanks,
Jens

--
View this message in context: http://camel.465427.n5.nabble.com/doTry-doCatch-with-original-message-tp5713695.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: doTry/doCatch with original message

Posted by Jens <sm...@dzbank.de>.
Claus Ibsen-2 wrote
> 
> On Wed, May 30, 2012 at 2:09 PM, Jens wrote:
>>
>> Jens wrote
>>>
>>>
>>> Claus Ibsen-2 wrote
>>>>
>>>> Hi
>>>>
>>>> Have you tried enabling stream caching?
>>>> http://camel.apache.org/stream-caching.html
>>>>
>>>
>>> Yes, and I also tried converting the message to a String right away but
>>> neither change helped.
>>>
>>> This is with Camel 2.8.3, by the way.
>>>
>>
>> It seems this problem is in some way related to the CXF component. If I
>> simply replace the routing to the primary CXF endpoint with a
>> throwException
>> the route works as expected, resuming with the original message in the
>> catch
>> block. So does the CXF component "erase" the orignal message? Is this
>> worthy
>> of filing a bug?
>>
> 
> Yes it would help a lot if you can create a small sample application /
> unit test that reproduces the issue.
> And then create a JIRA ticket and attach the sample.\
> 

https://issues.apache.org/jira/browse/CAMEL-5356

--
View this message in context: http://camel.465427.n5.nabble.com/doTry-doCatch-with-original-message-tp5713695p5714289.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: doTry/doCatch with original message

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, May 30, 2012 at 2:09 PM, Jens <sm...@dzbank.de> wrote:
>
> Jens wrote
>>
>>
>> Claus Ibsen-2 wrote
>>>
>>> Hi
>>>
>>> Have you tried enabling stream caching?
>>> http://camel.apache.org/stream-caching.html
>>>
>>
>> Yes, and I also tried converting the message to a String right away but
>> neither change helped.
>>
>> This is with Camel 2.8.3, by the way.
>>
>
> It seems this problem is in some way related to the CXF component. If I
> simply replace the routing to the primary CXF endpoint with a throwException
> the route works as expected, resuming with the original message in the catch
> block. So does the CXF component "erase" the orignal message? Is this worthy
> of filing a bug?
>

Yes it would help a lot if you can create a small sample application /
unit test that reproduces the issue.
And then create a JIRA ticket and attach the sample.\



> Thanks,
> Jens
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/doTry-doCatch-with-original-message-tp5713695p5713733.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.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: doTry/doCatch with original message

Posted by Jens <sm...@dzbank.de>.
Jens wrote
> 
> 
> Claus Ibsen-2 wrote
>> 
>> Hi
>> 
>> Have you tried enabling stream caching?
>> http://camel.apache.org/stream-caching.html
>> 
> 
> Yes, and I also tried converting the message to a String right away but
> neither change helped.
> 
> This is with Camel 2.8.3, by the way.
> 

It seems this problem is in some way related to the CXF component. If I
simply replace the routing to the primary CXF endpoint with a throwException
the route works as expected, resuming with the original message in the catch
block. So does the CXF component "erase" the orignal message? Is this worthy
of filing a bug?

Thanks,
Jens

--
View this message in context: http://camel.465427.n5.nabble.com/doTry-doCatch-with-original-message-tp5713695p5713733.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: doTry/doCatch with original message

Posted by Jens <sm...@dzbank.de>.
Claus Ibsen-2 wrote
> 
> Hi
> 
> Have you tried enabling stream caching?
> http://camel.apache.org/stream-caching.html
> 

Yes, and I also tried converting the message to a String right away but
neither change helped.

This is with Camel 2.8.3, by the way.

Jens

--
View this message in context: http://camel.465427.n5.nabble.com/doTry-doCatch-with-original-message-tp5713695p5713698.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: doTry/doCatch with original message

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Have you tried enabling stream caching?
http://camel.apache.org/stream-caching.html

On Tue, May 29, 2012 at 4:19 PM, Jens <sm...@dzbank.de> wrote:
> Hi list,
>
> I'm trying to route a message to a SOAP service via a CXF endpoint like
> this:
>
> from("cxf:bean:...").
>  doTry().
>    to("cxf:bean:primary").
>
>  doCatch(IOException.class).
>    to("cxf:bean:secondary").
>
>  end();
>
> So basically, send the message to the first service, and if that doesn't
> work, send it to the second instead. Unfortunately, when the catch block is
> triggered the message body is null so routing to the secondary endpoint
> fails, too. Is there a way to get the original message body back, or do I
> need to save/restore it myself somehow?
>
> Interestingly, using onException() does not seem to show the same problem.
>
> Thanks,
> Jens
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/doTry-doCatch-with-original-message-tp5713695.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.com
Author of Camel in Action: http://www.manning.com/ibsen