Seemingly simple “green path” code can quickly get complex when one considers all that can go wrong. Good old error handling and retries, its all been done before and in so many different ways.
Consider retries for transient errors, one can either re-invent the wheel (done more often than not), or use appropriate library code from Spring Batch (now Spring Retry) in a synchronous fashion, or hand the potential lengthy operation off for asynchronous handling.
When it comes to asynchronous handling, Tomasz Nurkiewicz has done the hard yards and written an informative post along with GitHub code that serves as an excellent tutorial in itself. Kudos to Tomasz!
I’m left wondering what the correlation is between the Java Active Object Pattern and the Async Retry Pattern, the Async part is seemingly the only correlation.