Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface {
metrics.Metricsable
log.Logable
io.Closer
// Delete deletes the queue with the given name.
Delete(context.Context, string) error
// Queue returns the queue with the given name.
Queue(context.Context, string) (Queue, error)
}
Connection provides a connection to a queueing system.
func NewConnection ¶
func NewConnection(d driver.Interface) Connection
New returns a connection wrapping the given driver.
type Message ¶
type Message interface {
metrics.Metricser
log.Logger
// AppendContent appends the message content to dst and returns the
// extended buffer.
AppendContent(dst []byte) []byte
// Content returns (a copy of) the message content.
Content() []byte
// Acknowledge removes the message from its queue.
Acknowledge(context.Context) error
// Requeue requeues the message.
Requeue(context.Context) error
}
Message represents a message in a queue.
type Queue ¶
type Queue interface {
metrics.Metricser
log.Logger
io.Closer
// Get returns the next message from the queue. The message will,
// eventually, be automatically requeued if it is not acknowledged.
Get(context.Context) (Message, error)
// Put places a message with the given content on the queue.
Put(context.Context, []byte) error
// Len returns the number of messages in the queue that are not awaiting
// acknowledgement.
Len(context.Context) (int, error)
// Name returns the name of the queue.
Name() string
}
Queue represents a queue.