redelivery

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// MaxRetries is maximum number of times a retry will be attempted.
	MaxRetries int

	// InitialBackoff is the first interval between retries. Subsequent intervals will be scaled by BackoffFactor.
	InitialBackoff time.Duration

	// MaxBackoff sets the limit for the exponential backoff of retries. The interval will not be
	// increased beyond MaxBackoff.
	MaxBackoff time.Duration

	// BackoffFactor is the factor by which the waiting interval will be multiplied between retries.
	BackoffFactor float64

	// MaxMessages is the maximum number of messages that can be concurrently managed by the redelivery service.
	MaxMessages int
}

Config holds the configuration parameters for the redelivery service.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration parameters for the redelivery service.

type Service

type Service struct {
	*Config
	*lifecycle.Lifecycle
	// contains filtered or unexported fields
}

Service manages redelivery of messages that failed delivery. The messages are published after a delay which is calculated according to the provided config, which includes an initial backoff and a backoff factor.

func NewService

func NewService(serviceName string, cfg *Config, notifyChan chan<- *message.Message) *Service

NewService returns a new redelivery service.

func (*Service) Add

func (m *Service) Add(msg *message.Message) (time.Time, error)

Add adds a message for redelivery. The time when the redelivery attempt will occur is returned, or an error is returned if the message cannot be redelivered. This function generally returns immediately, although if the number of messages already being redelivered has reached the MaxMessages limit then this function will block until a previously added message has been processed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL