Versions in this module Expand all Collapse all v0 v0.2.0 Nov 7, 2026 Changes in this version + var ErrInvalidConfig = errors.New("rabbitmq: invalid config") + var ErrNoURL = errors.New("rabbitmq: no url") + var ErrNotInitialized = errors.New("rabbitmq: not initialized") + type Config struct + AMQPConfig *amqp.Config + DialTimeout time.Duration + ErrorHandler func(error) + Heartbeat time.Duration + Host string + MaxRedelivery int + Password string + Port int + PrefetchCount int + PrefetchGlobal bool + Retry RetryConfig + Timeout time.Duration + URL string + URLs []string + User string + Vhost string + func ConfigDefault() Config + func (c *Config) Validate() error + func (c Config) DSN() string + func (c Config) ValidateDSN() error + type Conn struct + func NewConn(ctx context.Context, cfg Config) (*Conn, error) + func NewConnWithRetry(ctx context.Context, cfg Config) (*Conn, error) + func (c *Conn) Channel() (*amqp.Channel, error) + func (c *Conn) Close() error + func (c *Conn) NotifyClose() <-chan *amqp.Error + type Consumer interface + Close func() error + Consume func(ctx context.Context, queue string, handler MessageHandler) error + ConsumeWithConcurrency func(ctx context.Context, queue string, concurrency int, handler MessageHandler) error + EnsureQueue func(name string) error + func NewConsumer(ctx context.Context, cfg Config) (Consumer, error) + func NewConsumerWithRetry(ctx context.Context, cfg Config) (Consumer, error) + type ConsumerHandle interface + Close func() error + NotifyClose func() <-chan *amqp.Error + func WrapConsumer(c Consumer) ConsumerHandle + type MessageHandler func(ctx context.Context, msg amqp.Delivery) error + type Producer interface + Close func() error + Publish func(ctx context.Context, exchange, routingKey string, body []byte, ...) error + func NewProducer(ctx context.Context, cfg Config) (Producer, error) + func NewProducerWithRetry(ctx context.Context, cfg Config) (Producer, error) + type PublishOption func(*amqp.Publishing) + func WithContentType(ct string) PublishOption + func WithJSON() PublishOption + type RetryConfig struct + InitialDelay time.Duration + MaxAttempts int + MaxDelay time.Duration + Multiplier float64 + func DefaultRetryConfig() RetryConfig