Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotConnected = errors.New("not connected to a server") ErrAlreadyClosed = errors.New("already closed: not connected to the server") ErrShutdown = errors.New("client is shutting down") ErrConnectionFailed = errors.New("failed to connect to rabbitmq server") ErrCannotConfirmChannel = errors.New("cannot set confirm mode") ErrCannotDeclareExchange = errors.New("cannot declare exchange") ErrCannotDeclareQueue = errors.New("cannot declare queue") ErrCannotBindQueue = errors.New("cannot bind queue") ErrPublisherOptionsNotSet = errors.New("publisher options not set") ErrConsumerOptionsNotSet = errors.New("consumer options not set") ErrChannelNotInitialized = errors.New("channel not initialized") ErrChannelCloseFailed = errors.New("failed to close channel") ErrConnectionCloseFailed = errors.New("failed to close connection") ErrFailedToSetPrefetchCount = errors.New("failed to set prefetch count") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Delivery <-chan amqp.Delivery
Ready chan bool
// contains filtered or unexported fields
}
func New ¶
func New( connectionOptions options.ConnectionOptions, exchangeOptions options.ExchangeOptions, queueOptions options.QueueOptions, topic string, publisherOptions *options.PublisherOptions, consumerOptions *options.ConsumerOptions, readyChan chan bool, ) *Client
New creates a new consumer state instance, and automatically attempts to connect to the server.
func (*Client) Consume ¶
Consume 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.
func (*Client) Push ¶
func (client *Client) Push(message amqp.Publishing) error
Push will push data onto the queue, and wait for a confirm. This will block until the server sends a confirm. Errors are only returned if the push action itself fails, see UnsafePush.
func (*Client) SetNotifyClose ¶
SetNotifyClose will set the notify close channel
func (*Client) UnsafePush ¶
func (client *Client) UnsafePush(message amqp.Publishing) error
UnsafePush will push to the queue without checking for confirmation. It returns an error if it fails to connect. No guarantees are provided for whether the server will receive the message.