rbmq

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Transient  uint8 = 1 //暂存的消息
	Persistent uint8 = 2 //消息持久化

	//消息优先级
	PriorityMax uint8 = 9
	PriorityMin uint8 = 0
)

Variables

This section is empty.

Functions

func ConnectMq

func ConnectMq(url string) (conn *amqp.Connection, channel *amqp.Channel, err error)

ConnectMq new a rbmq connection,return conn,ch,error

func NewExclusiveMqConsumer

func NewExclusiveMqConsumer(url, exchange, queue, rkey, ctag string, ack, durable bool) (
	conn *amqp.Connection, channel *amqp.Channel, deliveries <-chan amqp.Delivery, err error)

NewExclusiveMqConsumer new a exclusive mq consumer

func NewMqConsumer

func NewMqConsumer(url, exchange, queue, rkey, ctag string, ack, durable bool) (
	conn *amqp.Connection, channel *amqp.Channel, deliveries <-chan amqp.Delivery, err error)

NewMqConsumer make a msg consumer创建一个消费者

func NewMqExchange

func NewMqExchange(channel *amqp.Channel, name, _type string, durable bool) error

NewMqExchange New a Exchange _type: 四种exchange类型:direct, topic, headers, fanout

fanout类型的exchange很简单,顾名思义:它将所接收到的消息广播给所有绑定的队列

func NewMqQueue

func NewMqQueue(channel *amqp.Channel, exchange, queue, rkey string, durable, exclusive bool) error

NewMqQueue declare a queue 声明一个队列,可以指定exchange,routing key durable 消息是否持久化

func PriorityPublish

func PriorityPublish(channel *amqp.Channel, exchange, rkey string, savedisk, priority uint8, msg []byte) error

PriorityPublish 指定优先级priority和是否消息持久化DeliveryMode

func Publish

func Publish(channel *amqp.Channel, exchange, rkey string, msg []byte) error

Publish publish a msg

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL