« Return to Thread: exception-type-filter with chaining-router

Re: exception-type-filter with chaining-router

by deepan s :: Rate this Message:

Reply to Author | View in Thread

Appreciate your quick response.

Thanks Antoine, what you suggested worked.

We have one more query,

Is there a condition based routing mechanism?
Say, i have 3 services (taking same input parameter) to be routed in order. And the routing should break and return to the caller when some condition gets satisfied (condition should be evaluated on the response of the service being called)

We can achieve the same using exception based routing by throwing an exception with-in each of the service when the condition is not satisfied (so that the routing proceeds to the next service), but is there a more elegant way of doing this without throwing an exception?

Regards,
Deepan Subramani.


Regards,
Deepan Subramani

antoine.borg wrote:
Hello,

The chaining router does not catch exceptions that are thrown so this is
the wrong router.  Perhaps using the Exception based router will help
though. I talk about this pattern on my blog:  http://ricston.com/blog/?p=22

A

deepan s wrote:
> Hi,
>
> We are trying to implement an exception handling strategy for services
> within a chaining router as explained below,
>
> We have,
> A. Mule "GetCustomerDetails" service with an outbound router that chains,
> A.1. "GetSourceSystem" service [throws SoruceNotFound exception],
> A.2. "GetCustDetailsFromSuperSource" service [called if SourceNotFound
> exception is thrown by A.1]
> A.3. "GetCustDetailsFromFoundSource" service [called if SourceNofFound
> exception is not thrown by A.1]
>
> B. Another mule "GetAssetDetails" service with an outbound router that
> chains,
> B.1. "GetSourceSystem" service [throws SoruceNotFound exception],
> B.2. "GetAssetDetailsFromSuperSource" service [called if SourceNotFound
> exception is thrown by B.1]
> B.3. "GetCustDetailsFromFoundSource" service [called if SourceNofFound
> exception is not thrown by B.1]
>
> Note that "GetSourceSystem" service appears in the chaining routers of both
> service A(GetCustomerDetails) & B(GetAssetDetails).
>
> Hence we might have to handle the SourceNotFound exception thrown by
> "GetSourceSystem" service within the respective chaining routers & NOT
> within the "GetSourceSystem" service itself.
>
> We tried using exception-type-filter within the chaining-router for
> "GetCustDetailsFromSuperSource" and "GetAssetDetailsFromSuperSource" to
> control the flow in case of SourceNotFound exception (as described in
> http://www.mulesource.org/display/MULE2USER/Error+Handling#ErrorHandling-UsingtheExceptionTypeFilter).
>
> Something like the below,
> <service name="GetCustomerDetails">
>     <inbound>
>          <vm:inbound-endpoint address="vm://getCustomerDetails"
> synchronous="true" />
>      </inbound>
>      <outbound>
>          <chaining-router>
>  <vm:outbound-endpoint address="vm://segmentationService"
> synchronous="true"/>
> <!--vm://getCustDetailsFromSuperSource service should be called when
> SourceNotFoundException IS thrown by vm://segmentationService-->
>  <vm:outbound-endpoint address="vm://getCustDetailsFromSuperSource"
> synchronous="true">
>         <exception-type-filter
> expectedType="com.xyz.SourceNotFoundException"/>
>  </vm:outbound-endpoint>
> <!--vm://getCustDetailsFromFoundSource service should be called when
> SourceNotFoundException IS NOT thrown by vm://segmentationService. Also Not
> sure how to skip the below call when SourceNotFoundException IS thrown-->
>  <vm:outbound-endpoint address="vm://getCustDetailsFromFoundSource"
> synchronous="true"/>
>         </chaining-router>
>      </outbound>
>   </service>
>
> But the SourceNotFound exception thrown by the "GetSourceSystem" service is
> not getting handled in the next service "GetCustDetailsFromSuperSource".
>
> Are we doing something wrong here? Can you please advice?
>
> Regards,
> Deepan Subramani.
>
>  

--

Antoine Borg, Senior Consultant | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM

See our full schedule of Mule and Android courses:
http://www.ricston.com/courses/schedules/

email: _antoine.borg_@ricston.com <mailto:antoine.borg@ricston.com> |
blog: blog.ricston.com <http://blog.ricston.com> | web: ricston.com
<http://www.ricston.com/>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

 « Return to Thread: exception-type-filter with chaining-router