Our application integration flow is defined as splitter -> ws gateway -> aggregator The splitter splits request into a list of account numbers; so that for each account number a web service call is initiated and the responses from multiple web service calls are aggregated in the aggregator.The channel between splitter and ws gateway is defined with dispatcher "commonj WorkManagerTaskExecutor" so that each webservice call is initiated parallelly in different threads.
If at least some of the web service call responds properly; even if all other calls result in SoapFault; we need to handle the scenario by using the data from the successful responses with a warning message quoting the error message from the fault response.
The issue is that resolveFault() method of FaultMessageResolver defined in the ws gateway does not return anything and the control never reaches the aggregator if at least one of the parallel web service call fails. Is there any way to handle such a scenario.
You can inject
SoapFaultMessageResolver
to the<int-ws:outbound-gateway>
(fault-message-resolver
). This one has pretty simple code:So, you failed WS invocation will end up with an
Exception
.Add
<int-ws:request-handler-advice-chain>
to your<int-ws:outbound-gateway>
and place there an instance ofExpressionEvaluatingRequestHandlerAdvice
. specify itserrorChannel
and do some agnostic logic in that sub-flow and send some specific message to your aggregator. Don't forget to carrysequenceDetails
headers with that messages.Having all messages in group aggregator will be able to release is as normal one.
In the end you can analyze result
List
for errors and normal responses.