Documentation ¶
Index ¶
- type RabbitMQ
- func (rq *RabbitMQ) BindQueueToExchange(consumerKey string, messageName string, routeKey string) error
- func (rq *RabbitMQ) Close()
- func (rq *RabbitMQ) Consume(queue string, consumer string) (<-chan amqp.Delivery, error)
- func (rq *RabbitMQ) DeclareConsumer(consumerKey string, durable bool, messageName string, consumerRouteKey string) (err error)
- func (rq *RabbitMQ) DeclareExchange(name string, kind string, durable bool) error
- func (rq *RabbitMQ) DeclareQueue(name string, durable bool) (queue amqp.Queue, err error)
- func (rq *RabbitMQ) DeleteExchange(name string) error
- func (rq *RabbitMQ) DeleteQueue(name string) error
- func (rq *RabbitMQ) GetChannel() (*amqp.Channel, error)
- func (rq *RabbitMQ) GetConnect() *amqp.Connection
- func (rq *RabbitMQ) GetExchangeName(name string) string
- func (rq *RabbitMQ) Publish(exchange string, routeKey string, body string) error
- func (rq *RabbitMQ) UnBindQueueToExchange(consumerKey string, messageName string, routeKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RabbitMQ ¶
type RabbitMQ struct { Uri string //amqp://guest:guest@localhost:5672/ Conn *amqp.Connection Channel *amqp.Channel }
func NewRabbitMQ ¶
return a rabbitMQ object
func (*RabbitMQ) BindQueueToExchange ¶
func (rq *RabbitMQ) BindQueueToExchange(consumerKey string, messageName string, routeKey string) error
bind queue to exchange params: consumerKey : message name+"-"consumerID messageName : message name routeKey : consumer routeKey
func (*RabbitMQ) DeclareConsumer ¶
func (rq *RabbitMQ) DeclareConsumer(consumerKey string, durable bool, messageName string, consumerRouteKey string) (err error)
declare consumer
func (*RabbitMQ) DeclareExchange ¶
declare exchange params: name : exchange name kind : exchange type (fanout, topic, direct) durable: true or false save exchange when the server is restarted
func (*RabbitMQ) DeclareQueue ¶
declare queue params: name : queue name durable : durable
func (*RabbitMQ) DeleteExchange ¶
delete a exchange params: name : exchange name
func (*RabbitMQ) DeleteQueue ¶
delete queue params: name : queue name
func (*RabbitMQ) GetChannel ¶
get mq Channel
func (*RabbitMQ) GetExchangeName ¶
get real exchange name(prefix+exchange)
Click to show internal directories.
Click to hide internal directories.