rabbit

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//direct|fanout|topic
	ExchangeTypeDirect = "direct"
	ExchangeTypeFanout = "fanout"
	ExchangeTypeTopic  = "topic"
)
View Source
const (
	Proto = "rabbit"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	EnableDeadLetter bool //开启死信队列
	DeadLetterQueue  string
	// contains filtered or unexported fields
}

Consumer Consumer

func NewConsumer

func NewConsumer(configName string, config config.Config) (consumer *Consumer, err error)

NewConsumerByConfig 创建新的Consumer

func (*Consumer) Close

func (c *Consumer) Close() (err error)

Close 关闭当前连接

func (*Consumer) Connect

func (c *Consumer) Connect() (err error)

Connect 连接服务器

func (*Consumer) Consume

func (consumer *Consumer) Consume(taskInfo queue.TaskInfo, callback queue.ConsumeCallback) (err error)

Consume 注册消费信息

func (*Consumer) Start

func (consumer *Consumer) Start() (err error)

Start 启动

func (*Consumer) Unconsume

func (consumer *Consumer) Unconsume(queue string)

UnConsume 取消注册消费

type Option

type Option func(opts *options)

func WithAddr

func WithAddr(addr string) Option

func WithExchange

func WithExchange(exchange string) Option

func WithExchangeType

func WithExchangeType(exchangeType string) Option

func WithVirtualHost

func WithVirtualHost(virtualHost string) Option

type Producer

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

Producer memcache配置文件

func NewProducer

func NewProducer(config config.Config, opts ...queue.Option) (m *Producer, err error)

NewProducerByConfig 根据配置文件创建一个redis连接

func (*Producer) BatchPush

func (p *Producer) BatchPush(ctx context.Context, key string, msgList ...queue.Message) error

func (*Producer) Close

func (c *Producer) Close() error

Close 释放资源

func (*Producer) DelayPush

func (c *Producer) DelayPush(ctx context.Context, key string, msg queue.Message, delaySeconds int64) error

Push 向存于 key 的列表的尾部插入所有指定的值

func (*Producer) Push

func (c *Producer) Push(ctx context.Context, key string, msg queue.Message) (err error)

Push 向存于 key 的列表的尾部插入所有指定的值

type QueueItem

type QueueItem struct {
	QueueName string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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