retry

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckFunc

type CheckFunc func(*task.Task) bool

CheckFunc is a function that checks a task to see if it should be retried. this may be used to modify the task struct

type Options

type Options struct {
	bus.Options `toml:"bus"`

	// topic and channel to listen to
	// done tasks for retry review.
	DoneTopic        string `toml:"done_topic" commented:"true"`
	DoneChannel      string `toml:"done_channel" commented:"true"`
	RetriedTopic     string `toml:"retried_topic" commented:"true" comment:"all retries published to this topic (disable with \"-\" value)"`
	RetryFailedTopic string `toml:"retry_failed_topic" commented:"true" comment:"all failures (retried and failed) published to this topic"`

	// retry rules
	RetryRules []*RetryRule `toml:"rule" commented:"true"`
}

func NewOptions

func NewOptions() *Options

type RetryRule

type RetryRule struct {
	TaskType string   `toml:"type"`
	Retries  int      `toml:"retry"`
	Wait     duration `toml:"wait"`  // duration to wait before creating and sending new task
	Topic    string   `toml:"topic"` // topic override (default is TaskType value)
}

type Retryer

type Retryer struct {
	sync.Mutex // mutex for updating the retryCache
	// contains filtered or unexported fields
}

func New

func New(conf *Options) (*Retryer, error)

func (*Retryer) SetCheckFunc

func (r *Retryer) SetCheckFunc(fn CheckFunc) *Retryer

SetCheckFunc overrides the default checkFunc

func (*Retryer) Start

func (r *Retryer) Start() error

Start will: - load the retry rules - connect the consumer - connect the producer - begin listening for error tasks

Jump to

Keyboard shortcuts

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