Please a bit of advice on the following:
I am using a ThreadPoolTaskExecutor to execute slow-external tasks like sending emails.
I need to improve this: 1) When the a task is passed to the exeuctor, it has to wait executing it till at least the transaction of the passing operation has finished. Example: i makes no sense to email something when the order process fails and generates an exception which occurs on commitment
2) When the task fails, some retry mechanism is used to try the task again. Example: when sending the email fails, it will be retried after 5,10 minutes and then throws an exception.
How to deal with these issues? of should I just integrate some queue that offers this functionality?..
Ed