Documentation
¶
Overview ¶
Package rabbitmq provides a RabbitMQ backend for the ling-base/mq broker abstraction. It supports automatic reconnection, publisher confirms, QoS prefetch, concurrent consumers, and topology management.
Index ¶
- type Broker
- func (b *Broker) Bind(queue, exchange, routingKey string) error
- func (b *Broker) Close() error
- func (b *Broker) Connect() error
- func (b *Broker) Consumer(queue string, opts mq.ConsumeOptions) (mq.Consumer, error)
- func (b *Broker) DeclareExchange(name string, opts mq.ExchangeOptions) error
- func (b *Broker) DeclareQueue(name string, opts mq.QueueOptions) error
- func (b *Broker) DeleteExchange(name string) error
- func (b *Broker) DeleteQueue(name string) error
- func (b *Broker) IsConnected() bool
- func (b *Broker) Metrics() mq.Metrics
- func (b *Broker) Producer(exchange string, opts mq.PublishOptions) (mq.Producer, error)
- func (b *Broker) Unbind(queue, exchange, routingKey string) error
- type Config
- type Consumer
- type Producer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker implements mq.Broker for RabbitMQ.
func (*Broker) DeclareExchange ¶
func (b *Broker) DeclareExchange(name string, opts mq.ExchangeOptions) error
DeclareExchange declares an exchange.
func (*Broker) DeclareQueue ¶
func (b *Broker) DeclareQueue(name string, opts mq.QueueOptions) error
DeclareQueue declares a queue.
func (*Broker) DeleteExchange ¶
DeleteExchange removes an exchange.
func (*Broker) DeleteQueue ¶
DeleteQueue removes a queue.
func (*Broker) IsConnected ¶
IsConnected reports whether the broker is currently connected.
type Config ¶
type Config struct {
// URL is the AMQP connection URL.
// Example: "amqp://guest:guest@localhost:5672/"
URL string
// DialerTimeout is the timeout for establishing a connection.
// Default: 10s.
DialerTimeout time.Duration
// ReconnectDelay is the delay between reconnection attempts.
// Default: 5s.
ReconnectDelay time.Duration
// MaxReconnectAttempts is the maximum number of reconnection
// attempts. 0 = unlimited.
MaxReconnectAttempts int
// Heartbeat is the AMQP heartbeat interval. Default: 10s.
// Set to 0 to disable.
Heartbeat time.Duration
// ChannelCacheSize is the maximum number of channels cached per
// connection. Default: 16.
ChannelCacheSize int
// Vhost is the RabbitMQ virtual host. If empty, uses the vhost
// from the URL or "/".
Vhost string
}
Config configures a RabbitMQ broker.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults for localhost.
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer implements mq.Consumer for RabbitMQ.
Click to show internal directories.
Click to hide internal directories.