Documentation
¶
Index ¶
- type Config
- type Consumer
- func (c *Consumer) Close() error
- func (c *Consumer) Consume(handler rabbitmq.Handler) error
- func (c *Consumer) SetExchange(exchange string, exType string)
- func (c *Consumer) SetOptions(options []func(*rabbitmq.ConsumeOptions))
- func (c *Consumer) SetQueue(queue string)
- func (c *Consumer) SetRoutingKey(routingKey []string)
- type Publisher
- func (p *Publisher) Close() error
- func (p *Publisher) Publish(msg []byte) error
- func (p *Publisher) PublishDelayed(msg []byte, ttl int64) error
- func (p *Publisher) SetExchange(exchange string)
- func (p *Publisher) SetOptions(options []func(*rabbitmq.PublishOptions))
- func (p *Publisher) SetRoutingKey(routingKey []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { MqUrl string // 消息队列连接地址配置 Exchange string // 交换机 RoutingKey string // 路由键 Queue string // 队列名 ExType string // 交换机类型 }
Config rabiitmq配置的抽象
func NewConfigByMap ¶
NewConfigByMap 从map[string]interface{}中新建一个Config
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer 消费者
func NewConsumerByConfig ¶
NewConsumerByConfig 通过Config
func NewDelayedQueueConsumer ¶
NewDelayedQueueConsumer 新建一个延迟队列的消费者。使用rabbitmq_delayed_message_exchange插件实现的延迟队列 因此需要安装对应版本的插件
func (*Consumer) SetExchange ¶
SetExchange 设置交换机
func (*Consumer) SetOptions ¶
func (c *Consumer) SetOptions(options []func(*rabbitmq.ConsumeOptions))
SetOptions 设置Options
func (*Consumer) SetRoutingKey ¶
SetRoutingKey 设置routingKey
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
func NewDelayedQueuePulisher ¶
NewDelayedQueuePulisher 创建一个publisher,使用DeleayedQueueConfig的配置
func NewPublisherByConfig ¶
NewPublisherByConfig 通过Config创建Publisher
func (*Publisher) PublishDelayed ¶
PublishDelayed 发送延迟消息,ttl是毫秒为单位
func (*Publisher) SetOptions ¶
func (p *Publisher) SetOptions(options []func(*rabbitmq.PublishOptions))
SetOptions 设置Options
func (*Publisher) SetRoutingKey ¶
SetRoutingKey 设置路由键
Click to show internal directories.
Click to hide internal directories.