Documentation ¶
Index ¶
Constants ¶
View Source
const ( MaxRetriesCountKey = "max_retries_count" CurrRetriesCountKey = "curr_retries_count" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logging ¶
type Logging struct {
Logger watermill.LoggerAdapter
}
func (Logging) Middleware ¶
func (l Logging) Middleware(h message.HandlerFunc) message.HandlerFunc
type Metrics ¶
type Metrics struct{}
func (Metrics) Middleware ¶
func (m Metrics) Middleware(h message.HandlerFunc) message.HandlerFunc
own custom metrics middleware, issue: limited watermill metrics middleware without the possibility to customize
type Recoverer ¶
type Recoverer struct {
Logger watermill.LoggerAdapter
}
func (Recoverer) Middleware ¶
func (rr Recoverer) Middleware(h message.HandlerFunc) message.HandlerFunc
type Retry ¶
type Retry struct { // MaxRetries is maximum number of times a retry will be attempted. MaxRetries int // InitialInterval is the first interval between retries. Subsequent intervals will be scaled by Multiplier. InitialInterval time.Duration // MaxInterval sets the limit for the exponential backoff of retries. The interval will not be increased beyond MaxInterval. MaxInterval time.Duration // Multiplier is the factor by which the waiting interval will be multiplied between retries. Multiplier float64 // MaxElapsedTime sets the time limit of how long retries will be attempted. Disabled if 0. MaxElapsedTime time.Duration // RandomizationFactor randomizes the spread of the backoff times within the interval of: // [currentInterval * (1 - randomization_factor), currentInterval * (1 + randomization_factor)]. RandomizationFactor float64 // 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) Logger watermill.LoggerAdapter }
Retry provides a middleware that retries the handler if retryable errors are returned. The retry behaviour is configurable, with exponential backoff and maximum elapsed time.
func (Retry) Middleware ¶
func (r Retry) Middleware(h message.HandlerFunc) message.HandlerFunc
Click to show internal directories.
Click to hide internal directories.