R_M
R_M

Reputation: 21

Spring Integration - How to aggregate errors from all splitters

I have a query around how to handle error scenarios in a best way when using Spring Integration.

Following is the usecase:

XML message

... some product related fields here . .

... some category related fields here . . .

I am using splitters to split the message into different elements, e.g. Products and Categories being processed by separate splitters.

If there are any errors on a single product or category element, I want to continue to processing of other elements and then after complete processing of the message, I want to send an email to the end-user about the errors in the incoming message.

Please could you suggest the best way to implementation this requirement.

Upvotes: 0

Views: 281

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121552

Your process should look like:

<splitter>
   <splitter>
   <aggregator>
<aggregator>

Each <splitter> should send its replies to the ExecutorChannel to proecess each item in parallel.

From other side before <spliter> there is needwith to handle downstrem exceptions.

Each ExceptionHandler should send a compensation message to the appropiate <aggregator> to have entire bunch of messages. Don't forget to copyHeaders from failedMessage to have SequenceDetails from <splitter> - it is necessary for <aggregator>.

Upvotes: 1

Related Questions