rabbitmq

package
v10.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotConnected is returned when not connected to a server
	ErrNotConnected = errors.New("not connected to a server")
	// ErrAlreadyClosed is returned when the connection is already closed
	ErrAlreadyClosed = errors.New("already closed: not connected to the server")
	// ErrShutdown is returned when already shutting down
	ErrShutdown = errors.New("session is shutting down")
	// ErrNack is returned when a message publish fails with a NACK
	ErrNack = errors.New("message was not sent")
	// ErrPublishOnly is returned when a channel is publish only and you try and use a queue function
	ErrPublishOnly = errors.New("channel is publish only")
	// ErrTimedOut is returned when a message times out waiting for confirmation
	ErrTimedOut = errors.New("confirmation timed out")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Name         string
	Exchange     string
	Addr         string
	DurableQueue bool
	DeleteUnused bool
	Exclusive    bool
	Args         amqp.Table
	Qos          int
	PublishOnly  bool
}

Config for the session

type Session

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

Session is the rabbitmq session

func New

func New(logger log.Logger, config Config) *Session

New creates a new consumer state instance, and automatically attempts to connect to the server.

func (*Session) Ack

func (session *Session) Ack(tag uint64) error

Ack a consumer tag

func (*Session) Bind

func (session *Session) Bind(routingKey string) error

Bind the queue to a routingKey

func (*Session) Close

func (session *Session) Close() error

Close will cleanly shutdown the channel and connection.

func (*Session) Push

func (session *Session) Push(routingKey string, data amqp.Publishing) error

Push will publish data to channel

func (*Session) Stream

func (session *Session) Stream(consumer string, autoAck bool, exclusive bool) (<-chan amqp.Delivery, error)

Stream will continuously put queue items on the channel. It is required to call delivery.Ack when it has been successfully processed, or delivery.Nack when it fails. Ignoring this will cause data to build up on the server.

Jump to

Keyboard shortcuts

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