Documentation
¶
Overview ¶
Package publishers provides implementations of various publisher strategies
Index ¶
- func NewBackoffPingingPublisher(ctx context.Context, publisher worker.Publisher, ...) (worker.Publisher, error)
- func NewDropToStdoutPublisher() worker.Publisher
- func NewPingingPublisher(ctx context.Context, publisher worker.Publisher, interval time.Duration, ...) worker.Publisher
- func NewRetryingWithFallbackPublisher(primary, fallback worker.Publisher, maxRetries uint, retryDelay time.Duration) worker.Publisher
- type BackoffOption
- type ErrInvalidBackoffConfig
- type ExponentialBackoffConfig
- type RetryingWithFallbackStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBackoffPingingPublisher ¶ added in v0.35.0
func NewBackoffPingingPublisher( ctx context.Context, publisher worker.Publisher, taskFunc func() (*worker.Task, error), opts ...BackoffOption, ) (worker.Publisher, error)
NewBackoffPingingPublisher creates a publisher that emits ping tasks only while idle, using exponential backoff between pings.
func NewDropToStdoutPublisher ¶
NewDropToStdoutPublisher creates a new publisher instance that writes hits to stdout
func NewPingingPublisher ¶
func NewPingingPublisher( ctx context.Context, publisher worker.Publisher, interval time.Duration, taskFunc func() (*worker.Task, error), ) worker.Publisher
NewPingingPublisher creates a new publisher that pings the given task at the given interval. Pings are only generated when no non-ping messages were published during the interval.
Types ¶
type BackoffOption ¶ added in v0.35.0
type BackoffOption func(*ExponentialBackoffConfig)
BackoffOption is a functional option for configuring ExponentialBackoffConfig.
func WithIntervalExpFactor ¶ added in v0.35.0
func WithIntervalExpFactor(factor float64) BackoffOption
WithIntervalExpFactor sets the exponential growth factor for the backoff.
func WithMaxInterval ¶ added in v0.35.0
func WithMaxInterval(d time.Duration) BackoffOption
WithMaxInterval sets the maximum interval for the backoff.
func WithMinInterval ¶ added in v0.35.0
func WithMinInterval(d time.Duration) BackoffOption
WithMinInterval sets the minimum interval for the backoff.
type ErrInvalidBackoffConfig ¶ added in v0.35.0
func (*ErrInvalidBackoffConfig) Error ¶ added in v0.35.0
func (e *ErrInvalidBackoffConfig) Error() string
type ExponentialBackoffConfig ¶ added in v0.35.0
type ExponentialBackoffConfig struct {
MinInterval time.Duration
IntervalExpFactor float64
MaxInterval time.Duration
}
func (ExponentialBackoffConfig) Validate ¶ added in v0.35.0
func (c ExponentialBackoffConfig) Validate() error
type RetryingWithFallbackStorage ¶
type RetryingWithFallbackStorage struct {
// contains filtered or unexported fields
}
RetryingWithFallbackStorage implements Storage interface with retry logic and fallback