rabbit

package
v0.0.0-...-640fa72 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMedium

func NewMedium(ctx context.Context, logger logrus.FieldLogger) *medium

func RunConsumer

func RunConsumer(
	ctx context.Context,
	uri, user, password, name string,
	prefetchCount, prefetchSize, count, limit int,
	handler MessageHandler,
	rlr RetryLimitReached,
	logger logrus.FieldLogger,
) *retryableConsumer

Types

type Channel

type Channel struct {
	*Connection
	*amqp.Channel
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(
	id int,
	connection *Connection,
	prefetchCount, prefetchSize int,
	logger logrus.FieldLogger,
) *Channel

func (Channel) Accept

func (c Channel) Accept(key string) (established, terminated, teared chan struct{})

func (Channel) Await

func (c Channel) Await()

func (Channel) Clean

func (c Channel) Clean()

func (Channel) Context

func (c Channel) Context() context.Context

func (*Channel) Name

func (c *Channel) Name() string

func (Channel) Notify

func (c Channel) Notify(events *sync.Map)

func (Channel) Remove

func (c Channel) Remove(key string)

func (*Channel) Start

func (c *Channel) Start()

func (*Channel) Stop

func (c *Channel) Stop()

type Connection

type Connection struct {
	*amqp.Connection
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(
	ctx context.Context,
	uri, user, password string,
	logger logrus.FieldLogger,
) *Connection

func (Connection) Accept

func (c Connection) Accept(key string) (established, terminated, teared chan struct{})

func (Connection) Await

func (c Connection) Await()

func (*Connection) Channel

func (c *Connection) Channel(prefetchCount, prefetchSize int) *amqp.Channel

func (Connection) Clean

func (c Connection) Clean()

func (Connection) Context

func (c Connection) Context() context.Context

func (*Connection) Name

func (c *Connection) Name() string

func (Connection) Notify

func (c Connection) Notify(events *sync.Map)

func (Connection) Remove

func (c Connection) Remove(key string)

func (*Connection) Start

func (c *Connection) Start()

func (*Connection) Stop

func (c *Connection) Stop()

type Medium

type Medium interface {
	cleaner.Cleanable
	Context() context.Context
	Start()
	Notify([]chan struct{})
	Accept(string) (established, terminated, teared chan<- struct{})
	Await()
	Clean()
}

type MessageHandler

type MessageHandler func(amqp.Table, []byte) error

type Publisher

type Publisher interface {
	Publish(exchange, topic string, data []byte)
	PublishJson(exchange, topic string, data interface{}) error
}

func RunPublisher

func RunPublisher(
	ctx context.Context,
	uri, user, password string,
	prefetchCount, prefetchSize, count int,
	logger logrus.FieldLogger,
) Publisher

type RetryLimitReached

type RetryLimitReached func(exchange, queue string, routeKeys []interface{}, body []byte)

Jump to

Keyboard shortcuts

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