Documentation
¶
Overview ¶
Package rabbitmq is the RabbitMQ engine of `komando queue` (AMQP 0-9-1, through github.com/rabbitmq/amqp091-go). It registers itself with queuex for amqp:// and amqps:// conns. Reading never removes a message: peek takes messages from the front of a queue and gives them back. ls, info and describe also use the management HTTP API when the URL names its port (?management=15672). See docs/features/queues.md.
Index ¶
- func Open(ctx context.Context, t driver.Target, password string, dial queuex.DialFunc, ...) (queuex.Queue, error)
- type Rabbit
- func (r *Rabbit) Close()
- func (r *Rabbit) Create(ctx context.Context, s queuex.TopicSpec, dryRun bool) (*queuex.Created, error)
- func (r *Rabbit) Delete(ctx context.Context, queues []string, dryRun bool) ([]queuex.Deleted, error)
- func (r *Rabbit) Describe(ctx context.Context, name string) (*queuex.TopicDetail, error)
- func (r *Rabbit) Groups(context.Context) ([]queuex.Group, error)
- func (r *Rabbit) Info(ctx context.Context) (*queuex.Info, error)
- func (r *Rabbit) Lag(context.Context, string) (*queuex.GroupLag, error)
- func (r *Rabbit) Peek(ctx context.Context, o queuex.PeekOptions) (*queuex.PeekResult, error)
- func (r *Rabbit) Purge(ctx context.Context, queue string, dryRun bool) (*queuex.Purged, error)
- func (r *Rabbit) Send(ctx context.Context, m queuex.Message, dryRun bool) (*queuex.Sent, error)
- func (r *Rabbit) Topics(ctx context.Context, pattern string, internal bool, limit int) ([]queuex.Topic, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Rabbit ¶
type Rabbit struct {
// contains filtered or unexported fields
}
Rabbit is a queuex.Queue on one virtual host of a RabbitMQ server.
func (*Rabbit) Close ¶
func (r *Rabbit) Close()
Close ends the connection; messages a peek still held go back to their queue then, as RabbitMQ does for every closed connection.
func (*Rabbit) Create ¶
func (r *Rabbit) Create(ctx context.Context, s queuex.TopicSpec, dryRun bool) (*queuex.Created, error)
Create declares a durable queue. RabbitMQ would answer a second declare of the same queue with "ok", so komando checks first and says QUEUE_EXISTS. A dry run checks the name and the settings komando knows, and makes nothing: RabbitMQ cannot check a queue without making it.
func (*Rabbit) Delete ¶
func (r *Rabbit) Delete(ctx context.Context, queues []string, dryRun bool) ([]queuex.Deleted, error)
Delete deletes queues and the messages in them; their consumers are cancelled. Every name must exist; with dry run it only says what each holds.
func (*Rabbit) Describe ¶
Describe reads one queue: with the management API all of it, otherwise what a passive queue.declare tells (ready messages and consumers).
func (*Rabbit) Info ¶
Info is the server's own words (product, version, cluster name) from the AMQP login, and with the management API its nodes and totals.
func (*Rabbit) Peek ¶
func (r *Rabbit) Peek(ctx context.Context, o queuex.PeekOptions) (*queuex.PeekResult, error)
Peek takes up to o.Limit messages from the front of the queue with basic.get, without acknowledging them, and gives them all back (nack with requeue): nothing is removed. RabbitMQ then marks them redelivered, and while peek holds them (a moment) no consumer gets them. If the connection drops in between, RabbitMQ puts them back by itself.
A quorum queue counts every return as a delivery (x-delivery-count) and drops or dead-letters a message after its delivery limit (20 by default since RabbitMQ 4.0). So peek stops with DELIVERY_LIMIT_NEAR once a message it showed has fewer than keepDeliveries deliveries left.
func (*Rabbit) Purge ¶
Purge deletes the messages waiting in a queue (ready) and keeps the queue. Messages a consumer holds and has not acknowledged stay.