rabbit_ch_pool

package module
v0.0.0-...-2652551 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNotConnected = errors.New("failed: not connected")
)

Functions

This section is empty.

Types

type ChannelPool

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

ChannelPool pool struct

func NewChannelPool

func NewChannelPool(opt *Options, conn *amqp.Connection) *ChannelPool

NewChannelPool create new pool with amqp channels

func (*ChannelPool) Get

func (p *ChannelPool) Get() (*amqp.Channel, error)

Get get channel from pool

func (*ChannelPool) Put

func (p *ChannelPool) Put(ch *amqp.Channel) error

Put put channel to pool

type Options

type Options struct {
	Addr            string
	PoolSize        int
	ExchangeDeclare bool
	ExchangeName    string
	ExchangeType    string
	PoolTimeout     time.Duration
	ReconnectDelay  time.Duration
}

Options config struct

type Pooler

type Pooler interface {
	Get() (*amqp.Channel, error)
	Put(ch *amqp.Channel) error
}

Pooler pool interface

type Rabbit

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

Rabbit service struct

func NewRabbit

func NewRabbit(opt *Options) *Rabbit

NewRabbit create new svc

func (*Rabbit) PublishMessage

func (r *Rabbit) PublishMessage(msg amqp.Publishing, routingKey string) error

PublishMessage publish message to queue

Jump to

Keyboard shortcuts

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