consumer

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeliveryAlreadyHandled = errors.New("delivery already handled")
)

Functions

This section is empty.

Types

type Closer added in v1.4.2

type Closer interface {
	Close()
}

type Consumer

type Consumer struct {
	Queue         string
	Name          string
	Concurrency   int
	PrefetchCount int
	Middlewares   []Middleware
	RetryPolicy   *retry.Policy
	Closer        Closer
	// contains filtered or unexported fields
}

func New

func New(handler Handler, queue string, opts ...Option) Consumer

func (*Consumer) Handler

func (c *Consumer) Handler() Handler

type Delivery

type Delivery struct {
	// contains filtered or unexported fields
}

func NewDelivery

func NewDelivery(donner Donner, source *amqp.Delivery, retrier *retry.Retryer) *Delivery

func (*Delivery) Ack

func (d *Delivery) Ack() error

func (*Delivery) Nack

func (d *Delivery) Nack(requeue bool) error

func (*Delivery) Retry added in v1.4.0

func (d *Delivery) Retry() error

func (*Delivery) Source

func (d *Delivery) Source() *amqp.Delivery

type Donner

type Donner interface {
	Done()
}

type Handler

type Handler interface {
	Handle(ctx context.Context, delivery *Delivery)
}

type HandlerFunc

type HandlerFunc func(ctx context.Context, delivery *Delivery)

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx context.Context, delivery *Delivery)

type Middleware

type Middleware func(next Handler) Handler

type Option

type Option func(c *Consumer)

func WithCloser added in v1.4.2

func WithCloser(closer Closer) Option

func WithConcurrency

func WithConcurrency(concurrency int) Option

func WithMiddlewares

func WithMiddlewares(middlewares ...Middleware) Option

func WithName

func WithName(name string) Option

func WithPrefetchCount

func WithPrefetchCount(prefetchCount int) Option

func WithRetryPolicy added in v1.4.0

func WithRetryPolicy(policy retry.Policy) Option

Jump to

Keyboard shortcuts

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