rabbitmq

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHeartbeat              = 10 * time.Second
	DefaultLocale                 = "en_US"
	DefaultClientConnectionsCount = 1
	DefaultClientChannelsPoolSize = 20
)

Variables

This section is empty.

Functions

func WithChannelsPoolSize added in v0.8.0

func WithChannelsPoolSize(n int) func(opts *PoolOptions)

func WithConnectionsCount added in v0.8.0

func WithConnectionsCount(n int) func(opts *PoolOptions)

func WithHeartbeat added in v0.8.0

func WithHeartbeat(d time.Duration) func(opts *PoolOptions)

func WithLocale added in v0.8.0

func WithLocale(locale string) func(opts *PoolOptions)

func WithTLSConfig added in v0.8.0

func WithTLSConfig(t *tls.Config) func(opts *PoolOptions)

Types

type Consumer

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

func NewConsumer

func NewConsumer(pool Pooler, queue string, workers int, name string) (*Consumer, error)

func (*Consumer) Serve added in v0.8.0

func (c *Consumer) Serve(ctx context.Context, handler DeliveryHandler) error

type DeliveryHandler

type DeliveryHandler interface {
	Handle(ctx context.Context, delivery *amqp.Delivery) error
}

type DeliveryHandlerFunc added in v0.8.0

type DeliveryHandlerFunc func(ctx context.Context, delivery *amqp.Delivery) error

func (DeliveryHandlerFunc) Handle added in v0.8.0

func (d DeliveryHandlerFunc) Handle(ctx context.Context, delivery *amqp.Delivery) error

type Pool added in v0.8.0

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

func NewPool added in v0.8.0

func NewPool(connStr string, name string, options ...func(opts *PoolOptions)) (*Pool, error)

func (*Pool) Close added in v0.8.0

func (p *Pool) Close() error

func (*Pool) GetAMQPChan added in v0.8.0

func (p *Pool) GetAMQPChan() (*amqp.Channel, error)

func (*Pool) ReleaseAMQPChan added in v0.8.0

func (p *Pool) ReleaseAMQPChan(channel *amqp.Channel)

type PoolOptions added in v0.8.0

type PoolOptions struct {
	ConnectionsCount int
	ChannelsPoolSize int
	TLSCfg           *tls.Config
	Heartbeat        time.Duration
	Locale           string
}

type Pooler added in v0.8.0

type Pooler interface {
	GetAMQPChan() (*amqp.Channel, error)
	ReleaseAMQPChan(channel *amqp.Channel)
	io.Closer
}

type Producer added in v0.8.0

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

func NewProducer added in v0.8.0

func NewProducer(name string, pool Pooler) (*Producer, error)

func (*Producer) Publish added in v0.8.0

func (p *Producer) Publish(ctx context.Context, pub amqp.Publishing, exchange, key string) error

Jump to

Keyboard shortcuts

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