Documentation ¶
Overview ¶
TODO: publish retry TODO: 重连是否加锁
Index ¶
- type Channel
- func (c *Channel) Cancel(consumerTag string, noWait bool) error
- func (c *Channel) Close() error
- func (c *Channel) Consume(queue, consumerTag string, autoAck, exclusive, noLocal bool, args amqp.Table, ...) error
- func (c *Channel) ConsumeNowait(queue, consumerTag string, autoAck, exclusive, noLocal bool, args amqp.Table, ...) error
- func (c *Channel) ExchangeDeclare(name string, kind string, durable bool, autoDelete bool, internal bool, ...) error
- func (c *Channel) ExchangeDeclareNoWait(name string, kind string, durable bool, autoDelete bool, internal bool, ...) error
- func (c *Channel) ExchangeDelete(name string, ifUnused bool) error
- func (c *Channel) ExchangeDeleteNoWait(name string, ifUnused bool) error
- func (c *Channel) PublishWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, ...) error
- func (c *Channel) PublishWithDeferredConfirmWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, ...) (*amqp.DeferredConfirmation, error)
- func (c *Channel) Qos(prefetchCount, prefetchSize int, global bool) error
- func (c *Channel) QueueBind(name, key, exchange string, args amqp.Table) error
- func (c *Channel) QueueBindNoWait(name, key, exchange string, args amqp.Table) error
- func (c *Channel) QueueDeclare(name string, durable bool, autoDelete bool, exclusive bool, args amqp.Table) (amqp.Queue, error)
- func (c *Channel) QueueDeclareNoWait(name string, durable bool, autoDelete bool, exclusive bool, args amqp.Table) (amqp.Queue, error)
- func (c *Channel) QueueDelete(name string, ifUnused, ifEmpty bool) (int, error)
- func (c *Channel) QueueDeleteNoWait(name string, ifUnused, ifEmpty bool) (int, error)
- func (c *Channel) QueueUnbind(name, key, exchange string, args amqp.Table) error
- type Connection
- type ConnectionOption
- type Consumer
- type CustomBackoff
- type ExponentialBackoff
- type ExponentialRandomBackoff
- type FixedBackoff
- type RecordedBinding
- type RecordedConsumer
- type RecordedExchange
- type RecordedQueue
- type RecoveryBackoff
- func NewCustomBackoff(intervals ...time.Duration) RecoveryBackoff
- func NewExponentialBackoff(initialInterval time.Duration, multiplier float64) RecoveryBackoff
- func NewExponentialRandomBackoff(initialInterval time.Duration, multiplier float64) RecoveryBackoff
- func NewFixedBackoff(interval time.Duration) RecoveryBackoff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
func (*Channel) ConsumeNowait ¶
func (*Channel) ExchangeDeclare ¶
func (*Channel) ExchangeDeclareNoWait ¶
func (*Channel) ExchangeDeleteNoWait ¶
func (*Channel) PublishWithContext ¶
func (*Channel) PublishWithDeferredConfirmWithContext ¶
func (c *Channel) PublishWithDeferredConfirmWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)
func (*Channel) QueueBindNoWait ¶
func (*Channel) QueueDeclare ¶
func (*Channel) QueueDeclareNoWait ¶
func (*Channel) QueueDelete ¶
func (*Channel) QueueDeleteNoWait ¶
type Connection ¶
type Connection struct { *amqp.Connection // contains filtered or unexported fields }
func Dial ¶
func Dial(url string, opts ...ConnectionOption) (*Connection, error)
func (*Connection) Channel ¶
func (c *Connection) Channel() (*Channel, error)
Channel 创建一个新的Channel 一个Connection可以创建多个Channel Channel是一个轻量级的Connection,可以用来发送和接收消息 不建议在多个goroutine中共享一个Channel https://www.rabbitmq.com/docs/channels#basics
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) IsClosed ¶
func (c *Connection) IsClosed() bool
type ConnectionOption ¶
type ConnectionOption func(*Connection)
func WithLogger ¶
func WithLogger(logger *slog.Logger) ConnectionOption
func WithRecoveryBackoff ¶
func WithRecoveryBackoff(backoff RecoveryBackoff) ConnectionOption
func WithRecoveryMaxAttempts ¶
func WithRecoveryMaxAttempts(maxAttempts int) ConnectionOption
type CustomBackoff ¶
type CustomBackoff struct {
// contains filtered or unexported fields
}
type ExponentialBackoff ¶
type ExponentialBackoff struct {
// contains filtered or unexported fields
}
type ExponentialRandomBackoff ¶
type ExponentialRandomBackoff struct {
// contains filtered or unexported fields
}
type FixedBackoff ¶
type FixedBackoff struct {
// contains filtered or unexported fields
}
type RecordedBinding ¶
type RecordedBinding struct { QueueName string ExchangeName string RoutingKey string Args amqp.Table }
func (*RecordedBinding) Equal ¶
func (rb *RecordedBinding) Equal(another *RecordedBinding) bool
type RecordedConsumer ¶
type RecordedExchange ¶
type RecordedQueue ¶
type RecoveryBackoff ¶
func NewCustomBackoff ¶
func NewCustomBackoff(intervals ...time.Duration) RecoveryBackoff
func NewExponentialBackoff ¶
func NewExponentialBackoff(initialInterval time.Duration, multiplier float64) RecoveryBackoff
func NewExponentialRandomBackoff ¶
func NewExponentialRandomBackoff(initialInterval time.Duration, multiplier float64) RecoveryBackoff
func NewFixedBackoff ¶
func NewFixedBackoff(interval time.Duration) RecoveryBackoff
Click to show internal directories.
Click to hide internal directories.