Something went wrong. Try again.
wip outbox library design
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041package outpost
import "time"
// Hooks observes relay activity. Every field is optional.//// Hook functions are called concurrently, from up to WithWorkers delivery// goroutines at a time, so implementations must be safe for concurrent use.type Hooks struct { // OnRetry reports a failure the relay will retry at retryAt: the time the // relay will next allow delivery, and the same value it records in the // store. It is the only backend-neutral way to observe the schedule. OnRetry func(info Info, cause error, retryAt time.Time)
// OnDeadLetter reports a failure the relay abandons, either because the // error was Permanent or because the attempts were exhausted. OnDeadLetter func(info Info, cause error)
// OnError reports a store error. Stale claims are expected and are not // reported here. OnError func(err error)}
func (h Hooks) retry(info Info, cause error, retryAt time.Time) { if h.OnRetry != nil { h.OnRetry(info, cause, retryAt) }}
func (h Hooks) deadLetter(info Info, cause error) { if h.OnDeadLetter != nil { h.OnDeadLetter(info, cause) }}
func (h Hooks) err(err error) { if h.OnError != nil { h.OnError(err) }}