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.