Documentation ¶
Index ¶
- Constants
- type RabbitMQ
- func NewRabbitMQ(queueName string, exchange string, key string) *RabbitMQ
- func NewRabbitMQPubSub(exchangeName string) *RabbitMQ
- func NewRabbitMQRouting(exchangeName string, routingKey string) *RabbitMQ
- func NewRabbitMQSimple(queueName string) *RabbitMQ
- func NewRabbitMQTopic(exchangeName string, routingKey string) *RabbitMQ
- func (r *RabbitMQ) ConsumeSimple()
- func (r *RabbitMQ) Destory()
- func (r *RabbitMQ) PublishPub(message string)
- func (r *RabbitMQ) PublishRouting(message string)
- func (r *RabbitMQ) PublishSimple(message string)
- func (r *RabbitMQ) PublishTopic(message string)
- func (r *RabbitMQ) ReceiveRouting()
- func (r *RabbitMQ) ReceiveSub()
- func (r *RabbitMQ) ReceiveTopic()
Constants ¶
View Source
const MQURL = "amqp://sxd:12345678@127.0.0.1:5672/sxd"
连接信息 amqp://sxd:sxd@127.0.0.1:5672/sxd 这个信息是固定不变的amqp://是固定参数后面两个是用户名密码ip地址端口号 vhost
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RabbitMQ ¶
type RabbitMQ struct { // 队列名称 QueueName string // 交换机名称 Exchange string // bind Key 名称 Key string // 连接信息 Mqurl string // contains filtered or unexported fields }
rabbitMQ结构体
func NewRabbitMQ ¶
创建结构体实例
func NewRabbitMQRouting ¶
路由模式创建RabbitMQ实例
func NewRabbitMQTopic ¶
话题模式创建RabbitMQ实例
func (*RabbitMQ) ReceiveTopic ¶
func (r *RabbitMQ) ReceiveTopic()
话题模式接受消息 要注意key,规则 其中 * 用于匹配一个单词,#用于匹配多个单词(可以是零个) 匹配 sxd.* 标识匹配 sxd.hello, sxd.hello.one 需要用sxd.#才能匹配到
Click to show internal directories.
Click to hide internal directories.