watermill
watermill copied to clipboard
Is there any way to write clean up hook after max retries?
This is just simple issue I had in mind. In my usecases, every time I retry, I change the entry in my databases to indicate how many retry in there. This case, is could be solved by using OnRetryHook on the Retry Middleware.
In my usecases, when the retry is at max limit, I want to do an action to do something (i.e notify me to Discord or anythings). What I had in mind was this....
type Retry struct {
// All the atributes goes in here....
// OnRetryHook is an optional function that will be executed on each retry attempt.
// The number of the current retry is passed as retryNum,
OnRetryHook func(retryNum int, delay time.Duration)
OnCleanUpHook func(msg *message.Message) // something like this
}
Is there any better way to do this or the package has built-in function to solve this? Thanks in advance