0

I am trying to write an error handler for my spring cloud stream application; however, the error handler is only called after all retries have been attempted. Is there a way to catch each exception and process them individually instead of waiting for the retries to be exhausted?

user
  • 5
  • 5

1 Answers1

2

What do you mean by "process" ?

The whole point of retry is to retry failures until successful or retries are exhausted.

That said, you can wire up your own RetryTemplate as described here and add a RetryListener to it so you can be notified of each failure.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • By "process" I mean that I'm writing the results to a DB and would like to retry the operation again. – user Oct 23 '18 at 18:44
  • Also, I was looking at https://docs.spring.io/spring-cloud-stream/docs/current/reference/html/ for docs. Is this not the latest documentation? That section you refer to does not appear in this doc. – user Oct 23 '18 at 18:49
  • Looks like that link is stale; it's always best to start at [the project page](https://cloud.spring.io/spring-cloud-stream/). – Gary Russell Oct 23 '18 at 19:07
  • I fixed the "current" link but it will take some time for the cache to expire. – Gary Russell Oct 23 '18 at 19:14