Documentation ¶
Index ¶
- type ConnectionPool
- type RabbitMQ
- func (r *RabbitMQ) Consumer(ctx context.Context, queueName string, consumerFunc queueLib.ConsumerFunc, ...)
- func (r *RabbitMQ) Publish(ctx context.Context, message messageLib.IMessage, ...) error
- func (r *RabbitMQ) RpcRequest(ctx context.Context, key string, data []byte, ...) ([]byte, error)
- func (r *RabbitMQ) Run(ctx context.Context)
- func (r *RabbitMQ) Shutdown(ctx context.Context)
- func (r *RabbitMQ) String() string
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 (*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 消息入生产者
Click to show internal directories.
Click to hide internal directories.