Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RabbitMQ ¶
type RabbitMQ struct {
QueueName string // 队列名称
Exchange string // 交换机 可为空
RouteKey string // 路由键 可为空
Addr string // 连接地址
Type string // 交换机连接方式 direct topic fanout headers 可为空
Done chan bool
ConnSuccess chan bool // 链接成功信息
PrefetchCount int // 消费者消费数据限流数
Durable bool // 是否queue队列持久化
// contains filtered or unexported fields
}
func New ¶
func New(config *Config, queueName, exchange, routeKey string, exchangeType, prefetchCount int, durable bool) (*RabbitMQ, error)
New 创建一个新的消费者状态实例,并自动尝试连接到服务器
func (*RabbitMQ) Consume ¶
Consume 将不断地将队列项放到通道上。 需要调用delivery.Ack 当它已经成功处理,或当它失败时,调用 delivery.Nack。 忽略这个参数会导致数据在服务器上堆积。
func (*RabbitMQ) Push ¶
Push 将数据推送到队列中,并等待确认。 如果在resendTimeout时间内没有收到确认信息, 它不断地重新发送消息,直到收到一个确认。 直到服务器发送确认信息。错误是只在推送操作本身失败时返回,参见UnsafePush。
func (*RabbitMQ) UnsafePush ¶
UnsafePush 将push到队列而不检查确认。如果连接失败,则返回错误。 没有提供服务器是否会接收消息。
Click to show internal directories.
Click to hide internal directories.