Versions in this module Expand all Collapse all v1 v1.0.0 Dec 8, 2024 Changes in this version + func Close() + func Consume(ctx context.Context, name string, handler Handler, ...) error + func GetConfig() map[string]*Config + func Load() + func Publish(ctx context.Context, name string, data []byte, opts ...options.PublishOption) error + func PublishWithDelay(ctx context.Context, name string, data []byte, delayTime int, ...) error + type Action int + const Ack + const NackDiscard + const NackRequeue + type Channel struct + func NewChannel(conn *Connection, opts *Config, logger log.Logger) (*Channel, error) + func (c *Channel) Close() error + func (c *Channel) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool, ...) (<-chan amqp091.Delivery, error) + func (c *Channel) IsClosed() bool + func (c *Channel) IsConnected() bool + func (c *Channel) Publish(ctx context.Context, exchange, key string, mandatory, immediate bool, ...) error + func (c *Channel) Qos(prefetchCount, prefetchSize int, global bool) error + type Config struct + AutoDeclare bool + Bind *options.BindOptions + Connection *options.ConnectionOptions + Exchange *options.ExchangeOptions + Queue *options.QueueOptions + Timeout time.Duration + URI string + type Connection struct + func NewConnection(opts *options.ConnectionOptions, logger log.Logger) (*Connection, error) + func (c *Connection) Close() error + func (c *Connection) Conn() *amqp091.Connection + func (c *Connection) IsClosed() bool + func (c *Connection) IsConnected() bool + type Consumer struct + func NewConsumer(conf *Config, logger log.Logger) (*Consumer, error) + func (c *Consumer) Close() error + func (c *Consumer) Consume(ctx context.Context, handler Handler, opts ...options.ConsumerOption) error + func (c *Consumer) IsClosed() bool + type Handler func(ctx context.Context, msg amqp091.Delivery) (action Action) + type Manager struct + var DefaultManager *Manager + func NewManager(opts map[string]*Config) *Manager + func (c *Manager) Close() error + func (c *Manager) GetConsumer(name string) (*Consumer, error) + func (c *Manager) GetProducer(name string) (*Producer, error) + type Producer struct + func NewProducer(conf *Config, logger log.Logger) (*Producer, error) + func (p *Producer) Close() error + func (p *Producer) Publish(ctx context.Context, message []byte, opts ...options.PublishOption) error