rabbitmq

package
v2.0.73 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionPool added in v2.0.67

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

ConnectionPool 是一个带有计数器和最大连接数限制的连接池

func NewConnectionPool added in v2.0.67

func NewConnectionPool(ctx context.Context, url string, maxConnections, reconnectInterval int,
	log rabbitmq.Logger, cfg *rabbitmq.Config) (*ConnectionPool, error)

NewConnectionPool 创建一个新的带有计数器和最大连接数限制的连接池

func (*ConnectionPool) Close added in v2.0.67

func (pool *ConnectionPool) Close(ctx context.Context) error

func (*ConnectionPool) GetConnection added in v2.0.67

func (pool *ConnectionPool) GetConnection(ctx context.Context) (*rabbitmq.Conn, error)

GetConnection 从连接池获取一个连接

func (*ConnectionPool) ReleaseConnection added in v2.0.67

func (pool *ConnectionPool) ReleaseConnection(conn *rabbitmq.Conn)

ReleaseConnection 将连接释放回连接池

type RabbitMQ

type RabbitMQ struct {
	Handler []rabbitmq.Handler

	ConsumerOptions *rabbitmq.ConsumerOptions

	PublisherOptions *rabbitmq.PublisherOptions
	Logger           rabbitmq.Logger
	// contains filtered or unexported fields
}

RabbitMQ cache implement

func NewRabbitMQ

func NewRabbitMQ(
	ctx context.Context,
	dsn string,
	maxConnections int,
	reconnectInterval int,
	cfg *rabbitmq.Config,
	logger rabbitmq.Logger,
) (*RabbitMQ, error)

func (*RabbitMQ) Consumer

func (r *RabbitMQ) Consumer(ctx context.Context, queueName string, consumerFunc queueLib.ConsumerFunc, optionFuncs ...func(*queueLib.ConsumeOptions))

Consumer 监听消费者

func (*RabbitMQ) Publish

func (r *RabbitMQ) Publish(ctx context.Context, message messageLib.IMessage, optionFuncs ...func(*queueLib.PublishOptions)) error

Publish 消息入生产者

func (*RabbitMQ) RpcRequest added in v2.0.23

func (r *RabbitMQ) RpcRequest(ctx context.Context, key string, data []byte, optionFuncs ...func(*queueLib.ClientOptions)) ([]byte, error)

RpcRequest AMQP RPC Request

func (*RabbitMQ) Run

func (r *RabbitMQ) Run(ctx context.Context)

func (*RabbitMQ) Shutdown

func (r *RabbitMQ) Shutdown(ctx context.Context)

func (*RabbitMQ) String

func (r *RabbitMQ) String() string

Jump to

Keyboard shortcuts

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