consumer

package
v1.39.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 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 Config

type Config struct {
	Address          string
	Queue            string
	ConnOpts         []ConnOption
	Concurrency      int
	Middlewares      []Middleware
	SubscriptionOpts []SubscriptionOption
	Observer         Observer
	ReconnectTimeout time.Duration
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(address string, queue string, handler Handler, opts ...Option) Config

func (Config) String

func (c Config) String() string

type ConnOption

type ConnOption = func(*stomp.Conn) error

type Consumer

type Consumer struct {
	Config
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Consumer, error)

func (*Consumer) Close

func (c *Consumer) Close() error

func (*Consumer) Run

func (c *Consumer) Run() error

type Delivery

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

func NewDelivery

func NewDelivery(donner Donner, conn *stomp.Conn, source *stomp.Message) *Delivery

func (*Delivery) Ack

func (d *Delivery) Ack() error

func (*Delivery) Nack

func (d *Delivery) Nack() error

func (*Delivery) Source

func (d *Delivery) Source() *stomp.Message

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 NoopObserver

type NoopObserver struct {
}

func (NoopObserver) BeginConsuming

func (n NoopObserver) BeginConsuming(c *Consumer)

func (NoopObserver) CloseDone

func (n NoopObserver) CloseDone(c *Consumer)

func (NoopObserver) CloseStart

func (n NoopObserver) CloseStart(c *Consumer)

func (NoopObserver) Error

func (n NoopObserver) Error(c *Consumer, err error)

type Observer

type Observer interface {
	Error(c *Consumer, err error)
	CloseStart(c *Consumer)
	CloseDone(c *Consumer)
	BeginConsuming(c *Consumer)
}

type Option

type Option func(c *Config)

func WithConcurrency

func WithConcurrency(concurrency int) Option

func WithConnectionOptions

func WithConnectionOptions(connOpts ...ConnOption) Option

func WithMiddlewares

func WithMiddlewares(middlewares ...Middleware) Option

func WithObserver

func WithObserver(observer Observer) Option

func WithSubscriptionOptions

func WithSubscriptionOptions(subOpts ...SubscriptionOption) Option

type SubscriptionOption

type SubscriptionOption = func(*frame.Frame) error

type Watcher

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

func NewWatcher

func NewWatcher(config Config) *Watcher

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context) error

func (*Watcher) Shutdown

func (w *Watcher) Shutdown()

Shutdown Perform graceful shutdown

Jump to

Keyboard shortcuts

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