Documentation ¶
Index ¶
- Variables
- type Bind
- type Consumer
- type Delivery
- type EventHandler
- type Exchange
- type Option
- type Queue
- type Session
- func (session *Session) AddConsumer(c *Consumer) error
- func (session *Session) ChannelClose() error
- func (session *Session) Close() error
- func (session *Session) ExchangeDeclare(ex Exchange) error
- func (session *Session) Publish(message []byte) error
- func (session *Session) PublishTo(exchange, key string, message []byte) error
- func (session *Session) QueueBind(b Bind) error
- func (session *Session) QueueDeclare(q Queue) error
- func (session *Session) Stream(c *Consumer) (<-chan amqp.Delivery, error)
- func (session *Session) Subscribe(handler func(Delivery) error) error
- func (session *Session) SubscribeTo(queue string, handler func(Delivery) error) error
- func (session *Session) UnsafePublish(message []byte, exchange, key string) error
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("session is shutting down") ErrNotSetDefaultQueue = errors.New("default queue is not set") ErrNotSetDefaultExchange = errors.New("default exchange or key is not set") )
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct { Name string QueueName string AutoAck bool Exclusive bool Handler EventHandler // contains filtered or unexported fields }
type EventHandler ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) AddConsumer ¶ added in v0.7.0
func (*Session) ChannelClose ¶
func (*Session) ExchangeDeclare ¶ added in v0.9.0
func (*Session) Publish ¶ added in v0.7.0
Push will push data onto the queue, and wait for a confirm. If no confirms are received until within the resendTimeout, it continuously re-sends messages until a confirm is received. This will block until the server sends a confirm. Errors are only returned if the push action itself fails, see UnsafePush.
func (*Session) QueueDeclare ¶
func (*Session) Stream ¶
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.
func (*Session) SubscribeTo ¶ added in v0.7.0
func (*Session) UnsafePublish ¶ added in v0.7.0
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 recieve the message.