2

Take for instance the following scenario: I split a message over an Iterator. If an exception is thrown inside a .handle() while iterating over an element, all the remaining elements are skipped and the next message is obtained. I need to suppress any possible exceptions so that all elements in the iterator are processed.

Since I am using Iterator instead of List, for instance, I cannot solve this using .aggregate().

Please, how can I manage to get the desired behaviour...?

  • Spring Boot Starter Integration 1.3.0
  • Spring Integration 4.2.1
  • Java DSL 1.1.1

Thanks in advance!

1 Answers1

2

Just place .channel(c -> c.executor(...)) after .split().

In this case all your messages will be processed in parallel (at least) and all the downstream errors will be wrapped into ErrorMessage and sent to the errorChannel (by default).

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118