mq

package
Version: v0.0.0-...-3b54ddd Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	*amqp.Channel
	// contains filtered or unexported fields
}

func (*Channel) Bind

func (ch *Channel) Bind() *Channel

bind刚刚声明的queue和exchange

func (*Channel) ExchangeDeclare

func (ch *Channel) ExchangeDeclare(exchange string, kind string, durable bool) *Channel

func (*Channel) Publish

func (ch *Channel) Publish(body []byte) error

func (*Channel) QueueDeclare

func (ch *Channel) QueueDeclare(queue string, durable bool) *Channel

func (*Channel) Receive

func (ch *Channel) Receive(h Handler) error

type Handler

type Handler func(amqp.Delivery) error

type Rabbit

type Rabbit struct {
	// contains filtered or unexported fields
}

func NewRabbit

func NewRabbit(url string) *Rabbit

func (*Rabbit) Publish

func (p *Rabbit) Publish(queue string, body []byte) error

发送也是长连接,短连接在连接上非常耗时

func (*Rabbit) Receive

func (p *Rabbit) Receive(queue string, h Handler) error

接收消息, 如果断线会在5s后重试

type RabbitFull

type RabbitFull struct {
	// contains filtered or unexported fields
}

func NewRabbitFull

func NewRabbitFull(url string) *RabbitFull

func (*RabbitFull) NewChannel

func (p *RabbitFull) NewChannel() (*Channel, error)

连接

func (*RabbitFull) SimplyPublish

func (p *RabbitFull) SimplyPublish(queue string, body []byte) error

发送也是长连接,短连接在连接上非常耗时

func (*RabbitFull) SimplyReceive

func (p *RabbitFull) SimplyReceive(exchange string, exchangeKind string, queue string, h Handler) error

接收消息, 如果断线会在5s后重试

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL