rabbit

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHandlerRequired = errors.New("Handler is required")
	ErrNameRequired    = errors.New("Name is required")
	ErrAlreadyStarted  = errors.New("Already started")
	ErrAlreadyStopped  = errors.New("Already closed")
	ErrSubIsClosed     = errors.New("Subscription is closed. Try to create a new one")
)

Functions

func CloseDefaultClient

func CloseDefaultClient()

func IsInitialized

func IsInitialized() bool

Types

type Client

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

func GetDefaultClient

func GetDefaultClient() *Client

func InitDefaultClient

func InitDefaultClient(cfg structure.RabbitConfig) *Client

func MakeClient

func MakeClient(config structure.RabbitConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close(eh ErrHandler)

func (*Client) Declare

func (c *Client) Declare(dls ...Declaration) error

func (*Client) Publish

func (c *Client) Publish(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error

func (*Client) Subscribe

func (c *Client) Subscribe(req SubRequest) (*Subscription, error)

type Declaration

type Declaration func(c *amqp.Channel) error

func DeclareExchange

func DeclareExchange(name, kind string, durable, autoDelete, internal, noWait bool, args amqp.Table) Declaration

func DeclareQueue

func DeclareQueue(name string, durable, autoDelete, exclusive, noWait bool, args amqp.Table) Declaration

func DeclateBinding

func DeclateBinding(name, key, exchange string, noWait bool, args amqp.Table) Declaration

type DisconnectionHandler

type DisconnectionHandler func(err *amqp.Error)

type ErrHandler

type ErrHandler func(err error)

type MsgHandler

type MsgHandler func(d amqp.Delivery)

type SubRequest

type SubRequest struct {
	ConcurrentConsumers int
	Handler             MsgHandler
	Queue               string
	Name                string
	PrefetchSize        int
}

type Subscription

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

func (*Subscription) Close

func (s *Subscription) Close(eh ErrHandler)

func (*Subscription) GetRequest

func (s *Subscription) GetRequest() SubRequest

func (*Subscription) IsActive

func (s *Subscription) IsActive() bool

func (*Subscription) Start

func (s *Subscription) Start() error

Register n concurrent consumers otherwise close all channels and become not reusable

func (*Subscription) Stop

func (s *Subscription) Stop() error

Unregister all otherwise close all channels and become not reusable

Jump to

Keyboard shortcuts

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