You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by Rajika Kumarasiri <ra...@wso2.com> on 2010/04/28 15:59:14 UTC

Synapse ignores registered fault handler if an exception thrown in out sequence of a proxy

Assume the following synapse configuration.

<proxy name="StockQuoteProxy">
        <target faultSequence="myFaultHandler">
            <inSequence>
               <!-- in sequence goes here -->
            </inSequence>
            <outSequence>
               <!-- out sequence goes here -->
            </outSequence>
        </target>
        <publishWSDL
uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
 </proxy>

<sequence name="myFaultHandler">
    <!-- fault sequence -->
</sequence>

It seems that the synapse ignores executing the fault handler
'myFaultHandler' when an exception is thrown in outSequence of the proxy
definition.
By looking at the code I can see that the registered fault handler only take
effect in inSequence, reason is the registered fault handler only added only
into out message context. But when we define a fault handler for the proxy
it should handle both exceptions occurs in in sequence and out sequence.
I fixed the problem by sharing the defined fault handler in, in message
context as well ( I have attached the diff). If you agree with the solution
I can provide this as patch.


Rajika
-- 
http://rajikak.blogspot.com/

Re: Synapse ignores registered fault handler if an exception thrown in out sequence of a proxy

Posted by Rajika Kumarasiri <ra...@wso2.com>.
Thanks for the feedback. I'll update the patch appropriately.

Rajika

On Wed, Apr 28, 2010 at 10:31 PM, Ruwan Linton <ru...@gmail.com>wrote:

> Also, please submit the patch via a JIRA.
>
> Thanks,
> Ruwan
>
>
> On Wed, Apr 28, 2010 at 10:27 PM, Ruwan Linton <ru...@gmail.com>wrote:
>
>> Rajika,
>>
>> This patch has an issue, where it pops the fault handler from the fault
>> stack, ideally you should get the proxy from the synapse configuration and
>> get the fault sequence from that and push into the fault stack of inMsgCtx.
>>
>> Otherwise, if there has been some other fault handler pushed, it will be
>> set as the fault handler which is wrong.
>>
>> Thanks,
>> Ruwan
>>
>> On Wed, Apr 28, 2010 at 7:29 PM, Rajika Kumarasiri <ra...@wso2.com>wrote:
>>
>>> Assume the following synapse configuration.
>>>
>>> <proxy name="StockQuoteProxy">
>>>         <target faultSequence="myFaultHandler">
>>>             <inSequence>
>>>                <!-- in sequence goes here -->
>>>             </inSequence>
>>>             <outSequence>
>>>                <!-- out sequence goes here -->
>>>             </outSequence>
>>>         </target>
>>>         <publishWSDL
>>> uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
>>>  </proxy>
>>>
>>> <sequence name="myFaultHandler">
>>>     <!-- fault sequence -->
>>> </sequence>
>>>
>>> It seems that the synapse ignores executing the fault handler
>>> 'myFaultHandler' when an exception is thrown in outSequence of the proxy
>>> definition.
>>> By looking at the code I can see that the registered fault handler only
>>> take effect in inSequence, reason is the registered fault handler only added
>>> only into out message context. But when we define a fault handler for the
>>> proxy it should handle both exceptions occurs in in sequence and out
>>> sequence.
>>> I fixed the problem by sharing the defined fault handler in, in message
>>> context as well ( I have attached the diff). If you agree with the solution
>>> I can provide this as patch.
>>>
>>>
>>> Rajika
>>> --
>>> http://rajikak.blogspot.com/
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>>> For additional commands, e-mail: dev-help@synapse.apache.org
>>>
>>
>>
>>
>> --
>> Ruwan Linton
>> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
>> WSO2 Inc.; http://wso2.org
>> email: ruwan@wso2.com; cell: +94 77 341 3097
>> blog: http://ruwansblog.blogspot.com
>>
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
http://rajikak.blogspot.com/

Re: Synapse ignores registered fault handler if an exception thrown in out sequence of a proxy

Posted by Ruwan Linton <ru...@gmail.com>.
Also, please submit the patch via a JIRA.

Thanks,
Ruwan

On Wed, Apr 28, 2010 at 10:27 PM, Ruwan Linton <ru...@gmail.com>wrote:

> Rajika,
>
> This patch has an issue, where it pops the fault handler from the fault
> stack, ideally you should get the proxy from the synapse configuration and
> get the fault sequence from that and push into the fault stack of inMsgCtx.
>
> Otherwise, if there has been some other fault handler pushed, it will be
> set as the fault handler which is wrong.
>
> Thanks,
> Ruwan
>
> On Wed, Apr 28, 2010 at 7:29 PM, Rajika Kumarasiri <ra...@wso2.com>wrote:
>
>> Assume the following synapse configuration.
>>
>> <proxy name="StockQuoteProxy">
>>         <target faultSequence="myFaultHandler">
>>             <inSequence>
>>                <!-- in sequence goes here -->
>>             </inSequence>
>>             <outSequence>
>>                <!-- out sequence goes here -->
>>             </outSequence>
>>         </target>
>>         <publishWSDL
>> uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
>>  </proxy>
>>
>> <sequence name="myFaultHandler">
>>     <!-- fault sequence -->
>> </sequence>
>>
>> It seems that the synapse ignores executing the fault handler
>> 'myFaultHandler' when an exception is thrown in outSequence of the proxy
>> definition.
>> By looking at the code I can see that the registered fault handler only
>> take effect in inSequence, reason is the registered fault handler only added
>> only into out message context. But when we define a fault handler for the
>> proxy it should handle both exceptions occurs in in sequence and out
>> sequence.
>> I fixed the problem by sharing the defined fault handler in, in message
>> context as well ( I have attached the diff). If you agree with the solution
>> I can provide this as patch.
>>
>>
>> Rajika
>> --
>> http://rajikak.blogspot.com/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Re: Synapse ignores registered fault handler if an exception thrown in out sequence of a proxy

Posted by Ruwan Linton <ru...@gmail.com>.
Rajika,

This patch has an issue, where it pops the fault handler from the fault
stack, ideally you should get the proxy from the synapse configuration and
get the fault sequence from that and push into the fault stack of inMsgCtx.

Otherwise, if there has been some other fault handler pushed, it will be set
as the fault handler which is wrong.

Thanks,
Ruwan

On Wed, Apr 28, 2010 at 7:29 PM, Rajika Kumarasiri <ra...@wso2.com> wrote:

> Assume the following synapse configuration.
>
> <proxy name="StockQuoteProxy">
>         <target faultSequence="myFaultHandler">
>             <inSequence>
>                <!-- in sequence goes here -->
>             </inSequence>
>             <outSequence>
>                <!-- out sequence goes here -->
>             </outSequence>
>         </target>
>         <publishWSDL
> uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
>  </proxy>
>
> <sequence name="myFaultHandler">
>     <!-- fault sequence -->
> </sequence>
>
> It seems that the synapse ignores executing the fault handler
> 'myFaultHandler' when an exception is thrown in outSequence of the proxy
> definition.
> By looking at the code I can see that the registered fault handler only
> take effect in inSequence, reason is the registered fault handler only added
> only into out message context. But when we define a fault handler for the
> proxy it should handle both exceptions occurs in in sequence and out
> sequence.
> I fixed the problem by sharing the defined fault handler in, in message
> context as well ( I have attached the diff). If you agree with the solution
> I can provide this as patch.
>
>
> Rajika
> --
> http://rajikak.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com