Documentation
¶
Index ¶
- func BotEventFire(ctx types.Context, eventName string, param types.KV) error
- func NewMessage(payload any) (*message.Message, error)
- func NewPublisher() (message.Publisher, error)
- func NewRouter() (*message.Router, error)
- func NewSubscriber() (message.Subscriber, error)
- func PublishMessage(ctx context.Context, topic string, payload any) error
- func SendMessage(ctx types.Context, msg types.MsgPayload) error
- type Retry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BotEventFire ¶ added in v0.23.1
func NewPublisher ¶
func NewSubscriber ¶
func NewSubscriber() (message.Subscriber, error)
func SendMessage ¶
func SendMessage(ctx types.Context, msg types.MsgPayload) error
Types ¶
type Retry ¶ added in v0.26.3
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 errors are returned. The retry behaviour is configurable, with exponential backoff and maximum elapsed time.
func (Retry) Middleware ¶ added in v0.26.3
func (r Retry) Middleware(h message.HandlerFunc) message.HandlerFunc
Middleware returns the Retry middleware.
Click to show internal directories.
Click to hide internal directories.