You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ext2 <xu...@tongtech.com> on 2010/03/26 06:07:51 UTC

How camel define content of message sent to catch clause ?


In camel , try-catch means , if exception occurs , catch-clause will be
execute. 
And how does camel define : What is message(catch-clause received) 's
content? 

Is the content exactly equals to the processed content where exception just
occurs?

For pipe line , catch-clause will received a message whose  content which
will be exactly where exception occurs;
But for multi-case , catch-clause can only received a message whose content
is the multi-case's received original message.

So the pipe-line and multi-cast doesn't consistence. Is it the multi-case 's
bug ? for example:

<doTry>
   <process1>
   <process2>
<doCatch>...</doCatch>
</doTry>

If process2 failed , catch clause will received message which content is the
process1's result.

But another multi-case example

<dotry>
	<multi-cast stopOnException="true">
		<pipeline> <process1><process2> </pipeline>
		<pipeline> <process3> <process4> </pipeline>
    </multi-cast>
<doCatch> </doCatch>
</dotry>

If process2 failed , doCatch will received message whose content is original
message send  to mult-cast, but not be the process1's result;

So is it a bug of multi-cast pattern?  



Re: How camel define content of message sent to catch clause ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 26, 2010 at 6:07 AM, ext2 <xu...@tongtech.com> wrote:
>
>
> In camel , try-catch means , if exception occurs , catch-clause will be
> execute.
> And how does camel define : What is message(catch-clause received) 's
> content?
>
> Is the content exactly equals to the processed content where exception just
> occurs?
>
> For pipe line , catch-clause will received a message whose  content which
> will be exactly where exception occurs;
> But for multi-case , catch-clause can only received a message whose content
> is the multi-case's received original message.
>
> So the pipe-line and multi-cast doesn't consistence. Is it the multi-case 's
> bug ? for example:
>
> <doTry>
>   <process1>
>   <process2>
> <doCatch>...</doCatch>
> </doTry>
>
> If process2 failed , catch clause will received message which content is the
> process1's result.
>
> But another multi-case example
>
> <dotry>
>        <multi-cast stopOnException="true">
>                <pipeline> <process1><process2> </pipeline>
>                <pipeline> <process3> <process4> </pipeline>
>    </multi-cast>
> <doCatch> </doCatch>
> </dotry>
>
> If process2 failed , doCatch will received message whose content is original
> message send  to mult-cast, but not be the process1's result;
>
> So is it a bug of multi-cast pattern?
>

That is how the multicast EIP pattern works. It sends the SAME message
to X destinations.
So if you continue routing AFTER the multicast you would use the
original message.

But Camel offers you to aggregate with the multicast. So in you case
you can add a aggregationStrategy to multicast and let it just use the
new exchange

>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: try-catch conflict with default-error-handler

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Mar 26, 2010 at 7:30 AM, ext2 <xu...@tongtech.com> wrote:
> Sorry, I forget to say, this is running on camel 2.2;
>
> I have checked the camel's document and source-code; the camel-document say
> " try-catch will disable the error-handler"; but while I checking the
> source-code of camel , it only disable  error-handlers of node (which is
> conjunction with doTry pattern).
>
>  In the following example, only <filter> processor is conjunction with
> <doTry>. So only filter processor's  error-handler is disabled. But
> error-handlers of  other processor which defined inside filter is not
> disabled.
>
> So the catch-clause is not invoked. Is it a bug?
>

I have created a ticket to look into it
https://issues.apache.org/activemq/browse/CAMEL-2577


> ---------------------------------------------------------------------------
> Follow route use a default-error-handler for the route, and also defined  a
> custom exception handle logic using try-catch-pattern.
>
> But if the "myProcessRaiseError" raised exception the catch-clause cannot be
> invoked; Why? Is it camel's bug?
>
>
> <route>
>      <from uri="ws:... "/>
>         <bean ...>
>        <doTry>
>         <filter>
>                <simple>${body} == 'firstChoice'</simple>
>                      <bean ref="myProcess" />
>                      <bean ref="myProcessRaiseError"/>
>              </filter>
>                <doCatch>
>                        ..some error handler...
>                </doCatch>
>        </doTry>
>     <process ...>
> </route>
>
>
>
>
>
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: try-catch conflict with default-error-handler

Posted by ext2 <xu...@tongtech.com>.
Sorry, I forget to say, this is running on camel 2.2;

I have checked the camel's document and source-code; the camel-document say
" try-catch will disable the error-handler"; but while I checking the
source-code of camel , it only disable  error-handlers of node (which is
conjunction with doTry pattern).

 In the following example, only <filter> processor is conjunction with
<doTry>. So only filter processor's  error-handler is disabled. But
error-handlers of  other processor which defined inside filter is not
disabled.

So the catch-clause is not invoked. Is it a bug?

---------------------------------------------------------------------------
Follow route use a default-error-handler for the route, and also defined  a
custom exception handle logic using try-catch-pattern. 

But if the "myProcessRaiseError" raised exception the catch-clause cannot be
invoked; Why? Is it camel's bug?


<route>
      <from uri="ws:... "/>
	 <bean ...>
	<doTry>
     	 <filter>
      		<simple>${body} == 'firstChoice'</simple>
		      <bean ref="myProcess" />
		      <bean ref="myProcessRaiseError"/>
	      </filter>
		<doCatch>
			..some error handler...
		</doCatch>
	</doTry>
     <process ...>
</route>







try-catch conflict with default-error-handler

Posted by ext2 <xu...@tongtech.com>.
Follow route use a default-error-handler for the route, and also defined  a
custom exception handle logic using try-catch-pattern. 

But if the "myProcessRaiseError" raised exception the catch-clause cannot be
invoked; Why? Is it camel's bug?


<route>
      <from uri="ws:... "/>
	 <bean ...>
	<doTry>
     	 <filter>
      		<simple>${body} == 'firstChoice'</simple>
		      <bean ref="myProcess" />
		      <bean ref="myProcessRaiseError"/>
	      </filter>
		<doCatch>
			..some error handler...
		</doCatch>
	</doTry>
     <process ...>
</route>