Documentation
¶
Overview ¶
Package nats is the NATS JetStream engine of `komando queue`, through github.com/nats-io/nats.go. It registers itself with queuex for nats:// and tls:// conns. A queue here is a JetStream stream: ls lists streams, describe shows one with its consumers, peek reads messages by their sequence number (no consumer, nothing acknowledged, nothing removed), send publishes to a subject a stream keeps. See docs/features/queues.md.
Index ¶
- func Open(ctx context.Context, t driver.Target, password string, dial queuex.DialFunc, ...) (queuex.Queue, error)
- type Nats
- func (n *Nats) Close()
- func (n *Nats) Create(ctx context.Context, s queuex.TopicSpec, dryRun bool) (*queuex.Created, error)
- func (n *Nats) Delete(ctx context.Context, streams []string, dryRun bool) ([]queuex.Deleted, error)
- func (n *Nats) Describe(ctx context.Context, name string) (*queuex.TopicDetail, error)
- func (n *Nats) Groups(ctx context.Context) ([]queuex.Group, error)
- func (n *Nats) Info(ctx context.Context) (*queuex.Info, error)
- func (n *Nats) Lag(ctx context.Context, group string) (*queuex.GroupLag, error)
- func (n *Nats) Peek(ctx context.Context, o queuex.PeekOptions) (*queuex.PeekResult, error)
- func (n *Nats) Purge(ctx context.Context, stream string, dryRun bool) (*queuex.Purged, error)
- func (n *Nats) Send(ctx context.Context, m queuex.Message, dryRun bool) (*queuex.Sent, error)
- func (n *Nats) Topics(ctx context.Context, pattern string, internal bool, limit int) ([]queuex.Topic, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
func Open(ctx context.Context, t driver.Target, password string, dial queuex.DialFunc, timeout time.Duration, clientID string) (queuex.Queue, error)
Open logs in to the conn's servers through dial (direct, --via an SSH server, or a VPN). nats.go adds TLS on top for tls:// (or when the server requires it), checked against the server's name.
Types ¶
type Nats ¶
type Nats struct {
// contains filtered or unexported fields
}
Nats is a queuex.Queue on a NATS account with JetStream.
func (*Nats) Create ¶
func (n *Nats) Create(ctx context.Context, s queuex.TopicSpec, dryRun bool) (*queuex.Created, error)
Create makes a stream. The server cannot check a stream without making it, so a dry run checks the name is free and komando's reading of the settings, and makes nothing.
func (*Nats) Delete ¶
Delete deletes streams with their messages and consumers. Every name must exist; with dry run it only says what each holds.
func (*Nats) Groups ¶
Groups lists the consumers of every stream. Lag is what each has not been given yet (pending).
func (*Nats) Info ¶
Info is the server komando talks to and its account's JetStream use. A server or account without JetStream still answers, with jetstream false.
func (*Nats) Lag ¶
Lag is one consumer, named STREAM/CONSUMER or by its name alone when only one stream has a consumer of that name.
func (*Nats) Peek ¶
func (n *Nats) Peek(ctx context.Context, o queuex.PeekOptions) (*queuex.PeekResult, error)
Peek reads messages straight from the stream by their sequence number, the way `nats stream get` does: no consumer is made, nothing is acknowledged and nothing is removed, also on a work-queue stream. By default the newest o.Limit, with o.Oldest the first ones still kept.