Documentation ¶
Index ¶
- Variables
- func DailSync(addr string) <-chan *amqp.Connection
- func DailWithTimeout(addr string, timeout time.Duration) (*amqp.Connection, error)
- type AmqpChannel
- func (ch *AmqpChannel) Ack(tag uint64, multiply bool) error
- func (ch *AmqpChannel) Close() error
- func (ch *AmqpChannel) Consume(queue, consumer string, autoAck, exclusive, noLocal, noWait bool) (<-chan amqp.Delivery, error)
- func (ch *AmqpChannel) ExchangeDeclare(name, kind string, durable, autoDelete, internal, noWait bool) error
- func (ch *AmqpChannel) Nack(tag uint64, multiply, requeue bool) error
- func (ch *AmqpChannel) Publish(exchange, routeKey string, msg amqp.Publishing) error
- func (ch *AmqpChannel) QueueBind(name, key, exchange string, noWait bool) error
- func (ch *AmqpChannel) QueueDeclare(name string, durable, autoDelete, exclusive, noWait bool) (amqp.Queue, error)
- type AmqpConnection
- type AmqpConsumer
- func (cm *AmqpConsumer) AckOne(tag uint64) bool
- func (cm *AmqpConsumer) Bind() error
- func (cm *AmqpConsumer) Close() error
- func (cm *AmqpConsumer) Consume() (<-chan amqp.Delivery, bool)
- func (cm *AmqpConsumer) ConsumeAuto(fn func(delivery amqp.Delivery), interval time.Duration)
- func (cm *AmqpConsumer) DeclareQueue() error
- func (cm *AmqpConsumer) NackSafe(tag uint64) bool
- func (cm *AmqpConsumer) SetQueue(q amqp.Queue)
- type AmqpProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Info = log.New(os.Stderr, "[GoodMQ] |INFO | ", log.LstdFlags) Error = log.New(os.Stderr, "[GoodMQ] |ERROR| ", log.LstdFlags) Warn = log.New(os.Stderr, "[GoodMQ] |WARN | ", log.LstdFlags) )
View Source
var (
RecoverDelay = 5 * time.Second
)
Functions ¶
func DailSync ¶
func DailSync(addr string) <-chan *amqp.Connection
func DailWithTimeout ¶
Types ¶
type AmqpChannel ¶
type AmqpChannel struct {
// contains filtered or unexported fields
}
AmqpChannel TODO channel may be closed by others errors (exchange is not exist, queue is not exist...)
currently only recovering channel when connection recovered.
func NewAmqpChannel ¶
func NewAmqpChannel(c *AmqpConnection) (*AmqpChannel, error)
func (*AmqpChannel) Ack ¶ added in v0.0.6
func (ch *AmqpChannel) Ack(tag uint64, multiply bool) error
func (*AmqpChannel) Close ¶
func (ch *AmqpChannel) Close() error
func (*AmqpChannel) ExchangeDeclare ¶ added in v0.0.5
func (ch *AmqpChannel) ExchangeDeclare(name, kind string, durable, autoDelete, internal, noWait bool) error
func (*AmqpChannel) Nack ¶ added in v0.0.6
func (ch *AmqpChannel) Nack(tag uint64, multiply, requeue bool) error
func (*AmqpChannel) Publish ¶
func (ch *AmqpChannel) Publish(exchange, routeKey string, msg amqp.Publishing) error
func (*AmqpChannel) QueueBind ¶
func (ch *AmqpChannel) QueueBind(name, key, exchange string, noWait bool) error
func (*AmqpChannel) QueueDeclare ¶
type AmqpConnection ¶
type AmqpConnection struct {
// contains filtered or unexported fields
}
func NewAmqpConnection ¶
func NewAmqpConnection(addr string) *AmqpConnection
func (*AmqpConnection) Close ¶
func (c *AmqpConnection) Close() error
func (*AmqpConnection) NewChannel ¶
func (c *AmqpConnection) NewChannel() (*amqp.Channel, error)
func (*AmqpConnection) NewConsumer ¶
func (c *AmqpConnection) NewConsumer() (*AmqpConsumer, error)
func (*AmqpConnection) NewProvider ¶
func (c *AmqpConnection) NewProvider() (*AmqpProvider, error)
func (*AmqpConnection) RemoveChan ¶
func (c *AmqpConnection) RemoveChan(chanId uuid.UUID)
type AmqpConsumer ¶
type AmqpConsumer struct { Channel *AmqpChannel QueName string //QueName 默认为空,自动生成唯一队列并赋值 ConsumerName string //ConsumerName 用于Consume,默认为空,会自动生成唯一标识符 AutoAck bool //AutoAck 用于Consume 默认为true RouteKey string //RouteKey 用于BindQueue,默认为空,自动生成为队列名称 Exchange string //Exchange 用于BindQueue, 默认为空,绑定将返回异常 Durable bool //Durable 用于QueueDeclare,默认为false DeleteUnused bool //DeleteUnused(auto-delete) 用于QueueDeclare,默认false // contains filtered or unexported fields }
func (*AmqpConsumer) AckOne ¶ added in v0.0.6
func (cm *AmqpConsumer) AckOne(tag uint64) bool
AckOne multiply=false
func (*AmqpConsumer) Bind ¶ added in v0.0.5
func (cm *AmqpConsumer) Bind() error
func (*AmqpConsumer) Close ¶
func (cm *AmqpConsumer) Close() error
func (*AmqpConsumer) ConsumeAuto ¶ added in v0.0.6
func (cm *AmqpConsumer) ConsumeAuto(fn func(delivery amqp.Delivery), interval time.Duration)
func (*AmqpConsumer) DeclareQueue ¶ added in v0.0.5
func (cm *AmqpConsumer) DeclareQueue() error
func (*AmqpConsumer) NackSafe ¶ added in v0.0.6
func (cm *AmqpConsumer) NackSafe(tag uint64) bool
NackSafe multiply=false, requeue=true
func (*AmqpConsumer) SetQueue ¶ added in v0.0.5
func (cm *AmqpConsumer) SetQueue(q amqp.Queue)
type AmqpProvider ¶
type AmqpProvider struct { Channel *AmqpChannel Exchange string RouteKey string }
func (*AmqpProvider) Close ¶
func (p *AmqpProvider) Close() error
func (*AmqpProvider) Publish ¶
func (p *AmqpProvider) Publish(msg amqp.Publishing) bool
func (*AmqpProvider) PublishDirect ¶ added in v0.0.5
func (p *AmqpProvider) PublishDirect(exchange, routeKey string, msg amqp.Publishing) bool
Click to show internal directories.
Click to hide internal directories.