dlq

package
v0.0.0-...-98adc55 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DLQ

type DLQ[T any] struct {
	// contains filtered or unexported fields
}

func NewDLQ

func NewDLQ[T any]() *DLQ[T]

func NewDLQWithDelay

func NewDLQWithDelay[T any](retryDelay func(retries int) time.Duration) *DLQ[T]

func (*DLQ[T]) AddItem

func (dlq *DLQ[T]) AddItem(item T, retries int)

func (*DLQ[T]) AddItemHighPriority

func (dlq *DLQ[T]) AddItemHighPriority(item T)

func (*DLQ[T]) GetNextItem

func (dlq *DLQ[T]) GetNextItem() (value *Item[T], ok bool)

func (*DLQ[T]) Size

func (dlq *DLQ[T]) Size() int

type Item

type Item[T any] struct {
	Value   T
	Retries int
	// contains filtered or unexported fields
}

Item This is generic so that metadata about retries can be maintained in an envelope during processing for when an item needs to make its way back onto the DLQ later

func MapItem

func MapItem[T, U any](b Item[T], mapper func(T) U) Item[U]

type RetryStrategy

type RetryStrategy func(retries int) time.Duration

RetryStrategy takes the number of retries and returns a Duration. This allows the caller to implement any strategy they like, be it constant, linear, exponential, etc.

func RetryDelayLinear

func RetryDelayLinear(backoff time.Duration) RetryStrategy

Jump to

Keyboard shortcuts

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