queuex

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package queuex talks to message queues for `komando queue`: Apache Kafka (and what speaks its protocol: Redpanda, MSK, Confluent Cloud) through franz-go, and the engines that register themselves from its subfolders (RabbitMQ, NATS JetStream, Amazon SQS, Google Cloud Pub/Sub). Reading never moves a consumer group or removes a message; see docs/design/queue.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTimeout added in v0.10.0

func IsTimeout(err error) bool

IsTimeout reports whether err is a network timeout.

func Match

func Match(pattern, name string) bool

Match says whether name matches a shell-style pattern ("" and "*" match everything).

func NotSupported

func NotSupported(what, engine, hint string) error

NotSupported is the answer of an engine to a verb or flag it cannot do.

func Register

func Register(kind string, open OpenFunc)

Register makes Open use open for conns of kind (a driver.Kind name).

func Text

func Text(b []byte, maxBytes int) (string, string, bool)

Text shows bytes as text when they are UTF-8, otherwise as base64 (the second value is then "base64"); cut to maxBytes first (a rune cut in half at the end is dropped). The third value says whether it was cut.

Types

type Broker

type Broker struct {
	ID         int32  `json:"id"`
	Address    string `json:"address"` // as it advertises itself
	Rack       string `json:"rack,omitempty"`
	Controller bool   `json:"controller,omitempty"`
	Version    string `json:"version,omitempty"` // a guess from the API versions it takes
}

Broker is one broker of the cluster.

type Created

type Created struct {
	Topic string `json:"topic,omitempty"` // kafka
	Queue string `json:"queue,omitempty"` // rabbitmq, sqs
	*KafkaCreated
	*RabbitCreated
	*NatsCreated
	*SqsCreated
	*PubsubCreated
	Subscription string `json:"subscription,omitempty"` // pubsub
	DryRun       bool   `json:"dry_run,omitempty"`
}

Created is the topic or queue made (or checked, with dry run).

type Deleted

type Deleted struct {
	Topic  string `json:"topic,omitempty"`  // kafka
	Queue  string `json:"queue,omitempty"`  // rabbitmq, sqs
	Stream string `json:"stream,omitempty"` // nats
	// pubsub: a subscription (a topic is in Topic)
	Subscription string `json:"subscription,omitempty"`
	Messages     int64  `json:"messages"` // how many it held; -1: not known (pubsub)
	Consumers    *int   `json:"consumers,omitempty"`
	Exists       bool   `json:"exists"`
}

Deleted is one topic or queue `queue rm` deleted (or would).

func (Deleted) Name

func (d Deleted) Name() string

Name is the topic's, the queue's or the stream's name.

type DialFunc

type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)

DialFunc opens a TCP connection, possibly through an SSH host or a VPN.

type Group

type Group struct {
	Name     string   `json:"name"`
	State    string   `json:"state"`
	Protocol string   `json:"protocol,omitempty"` // range, roundrobin, cooperative-sticky ...
	Members  int      `json:"members"`
	Topics   []string `json:"topics"`
	Lag      int64    `json:"lag"`
	Error    string   `json:"error,omitempty"`
	*NatsConsumer
	*PubsubSubscription
}

Group is one line of `queue groups`: a Kafka consumer group, or a NATS consumer (NatsConsumer says more).

type GroupLag

type GroupLag struct {
	Group      string         `json:"group"`
	State      string         `json:"state"`
	Members    int            `json:"members"`
	Lag        int64          `json:"lag"`
	Partitions []PartitionLag `json:"partitions"` // nats: none, a stream has no partitions
	*NatsConsumer
}

GroupLag is `queue lag`: one group, per topic and partition.

type GroupOnTopic

type GroupOnTopic struct {
	Group string `json:"group"`
	State string `json:"state"`
	Lag   int64  `json:"lag"`
}

GroupOnTopic is a consumer group that reads a topic, and how far behind.

type Info

type Info struct {
	Engine  string `json:"engine"` // kafka | rabbitmq | nats | sqs | pubsub
	Version string `json:"version,omitempty"`
	*KafkaInfo
	*RabbitInfo
	*NatsInfo
	*SqsInfo
	*PubsubInfo
}

Info is the cluster at a glance. Engine says which of the embedded parts is there.

type Kafka

type Kafka struct {
	// contains filtered or unexported fields
}

Kafka is a Queue on a Kafka cluster.

func (*Kafka) Close

func (k *Kafka) Close()

Close ends the conn's connections.

func (*Kafka) Create

func (k *Kafka) Create(ctx context.Context, s TopicSpec, dryRun bool) (*Created, error)

Create makes a topic; with dry run the brokers only check it (validate_only), so a bad setting or too many replicas shows now.

func (*Kafka) Delete

func (k *Kafka) Delete(ctx context.Context, topics []string, dryRun bool) ([]Deleted, error)

Delete deletes topics. Every name must exist; with dry run it only says what each holds.

func (*Kafka) Describe

func (k *Kafka) Describe(ctx context.Context, name string) (*TopicDetail, error)

Describe reads a topic's partitions, its own settings and the groups that read it.

func (*Kafka) Groups

func (k *Kafka) Groups(ctx context.Context) ([]Group, error)

Groups lists the consumer groups with their total lag.

func (*Kafka) Info

func (k *Kafka) Info(ctx context.Context) (*Info, error)

Info reads the brokers, the controller and a version guess.

func (*Kafka) Lag

func (k *Kafka) Lag(ctx context.Context, group string) (*GroupLag, error)

Lag is one group's position in every partition it reads.

func (*Kafka) Peek

func (k *Kafka) Peek(ctx context.Context, o PeekOptions) (*PeekResult, error)

Peek reads messages directly from the partitions: no consumer group, no committed offset, nothing removed, so no application notices.

func (*Kafka) Purge

func (k *Kafka) Purge(ctx context.Context, topic string, dryRun bool) (*Purged, error)

Purge deletes every message of a topic and keeps the topic (Kafka's DeleteRecords up to each partition's end).

func (*Kafka) Send

func (k *Kafka) Send(ctx context.Context, m Message, dryRun bool) (*Sent, error)

Send publishes one message and waits for the brokers to keep it. The topic must exist: komando never lets the brokers create one on the fly.

func (*Kafka) Topics

func (k *Kafka) Topics(ctx context.Context, pattern string, internal bool) ([]Topic, error)

Topics lists topics whose name matches pattern (shell style: orders-*).

type KafkaCreated

type KafkaCreated struct {
	Partitions int32             `json:"partitions"`
	Replicas   int16             `json:"replicas"`
	Config     map[string]string `json:"config"`
}

KafkaCreated is the Kafka topic made.

type KafkaInfo

type KafkaInfo struct {
	ClusterID  string   `json:"cluster_id,omitempty"`
	Controller int32    `json:"controller"` // broker id, -1 when unknown
	Brokers    []Broker `json:"brokers"`
	Topics     int      `json:"topics"` // not counting internal ones
}

KafkaInfo is what `queue info` shows of a Kafka cluster.

type KafkaRecord

type KafkaRecord struct {
	Partition int32     `json:"partition"`
	Offset    int64     `json:"offset"`
	Timestamp time.Time `json:"timestamp"`
	Key       *string   `json:"key"` // null: no key
}

KafkaRecord is where a message is in a Kafka topic.

type KafkaSent

type KafkaSent struct {
	Partition *int32     `json:"partition"` // null on a dry run without --partition: chosen when sent
	Offset    *int64     `json:"offset"`    // null on a dry run
	Timestamp *time.Time `json:"timestamp,omitempty"`
}

KafkaSent is where a message went in a Kafka topic.

type KafkaTopic

type KafkaTopic struct {
	Partitions int  `json:"partitions"`
	Replicas   int  `json:"replicas"`
	Internal   bool `json:"internal,omitempty"`
}

KafkaTopic is what `queue ls` shows of a Kafka topic.

type KafkaTopicDetail

type KafkaTopicDetail struct {
	ID         string            `json:"id,omitempty"`
	Internal   bool              `json:"internal,omitempty"`
	Replicas   int               `json:"replicas"`
	Partitions []Partition       `json:"partitions"`
	Config     map[string]string `json:"config"` // settings that differ from the broker's defaults
	Groups     []GroupOnTopic    `json:"groups"`
}

KafkaTopicDetail is what `queue describe` shows of a Kafka topic.

type Message

type Message struct {
	Topic     string
	Key       []byte // nil: no key
	Value     []byte
	Headers   [][2]string
	Partition int32 // -1: the broker's usual choice (by key, or spread out)
}

Message is what `queue send` publishes.

type NatsAccount

type NatsAccount struct {
	Streams      int    `json:"streams"`
	Consumers    int    `json:"consumers"`
	Memory       uint64 `json:"memory"`  // bytes kept in memory streams
	Storage      uint64 `json:"storage"` // bytes kept in file streams
	MaxMemory    int64  `json:"max_memory"`
	MaxStorage   int64  `json:"max_storage"`
	MaxStreams   int    `json:"max_streams"`
	MaxConsumers int    `json:"max_consumers"` // -1: no limit, for all four
}

NatsAccount is the JetStream use and limits of the conn's account.

type NatsCluster

type NatsCluster struct {
	Name     string        `json:"name,omitempty"`
	Leader   string        `json:"leader,omitempty"`
	Replicas []NatsReplica `json:"replicas,omitempty"`
}

NatsCluster is where a stream's copies are: the leader and the others.

type NatsConsumer

type NatsConsumer struct {
	Stream         string     `json:"stream"`
	Consumer       string     `json:"consumer,omitempty"` // describe: its name (groups and lag say it as "name")
	Durable        bool       `json:"durable"`
	Kind           string     `json:"kind"`       // pull or push
	AckPolicy      string     `json:"ack_policy"` // explicit, all or none
	FilterSubjects []string   `json:"filter_subjects,omitempty"`
	Pending        uint64     `json:"pending"`
	AckPending     int        `json:"ack_pending"`
	Redelivered    int        `json:"redelivered"`
	Waiting        int        `json:"waiting"`       // pull requests waiting for messages
	DeliveredSeq   uint64     `json:"delivered_seq"` // the last stream sequence it was given
	AckFloorSeq    uint64     `json:"ack_floor_seq"` // every message up to here is acknowledged
	LastActive     *time.Time `json:"last_active,omitempty"`
	Paused         bool       `json:"paused,omitempty"`
}

NatsConsumer is one consumer of a stream (`describe`, `groups`, `lag`). Pending is what it has not been given yet; AckPending what it was given and has not acknowledged.

type NatsCreated

type NatsCreated struct {
	Stream      string     `json:"stream"`
	Subjects    []string   `json:"subjects"`
	Storage     string     `json:"storage"`
	Retention   string     `json:"retention"`
	Discard     string     `json:"discard"`
	NumReplicas int        `json:"num_replicas"`
	Limits      NatsLimits `json:"limits"`
}

NatsCreated is the stream `queue create` made.

type NatsInfo

type NatsInfo struct {
	ServerName  string       `json:"server_name,omitempty"`
	ServerID    string       `json:"server_id"`
	ClusterName string       `json:"cluster_name,omitempty"`
	Connected   string       `json:"connected"`   // the server komando talks to (host:port)
	MaxPayload  int64        `json:"max_payload"` // the largest message the server takes, in bytes
	JetStream   bool         `json:"jetstream"`   // whether the account has JetStream (streams)
	Domain      string       `json:"domain,omitempty"`
	Account     *NatsAccount `json:"account,omitempty"`
}

NatsInfo is what `queue info` shows of a NATS server and its account.

type NatsLimits

type NatsLimits struct {
	MaxMsgs           int64  `json:"max_msgs"`
	MaxBytes          int64  `json:"max_bytes"`
	MaxAge            string `json:"max_age"` // a duration, "0s" for no limit
	MaxMsgSize        int32  `json:"max_msg_size"`
	MaxMsgsPerSubject int64  `json:"max_msgs_per_subject"`
	MaxConsumers      int    `json:"max_consumers"`
	DuplicateWindow   string `json:"duplicate_window,omitempty"`
}

NatsLimits are a stream's limits; 0 or -1 is "no limit".

type NatsMsg

type NatsMsg struct {
	Subject  string    `json:"subject"`
	Sequence uint64    `json:"sequence"`
	Time     time.Time `json:"time"`
}

NatsMsg is where a message `queue peek` read is in its stream.

type NatsReplica

type NatsReplica struct {
	Name    string `json:"name"`
	Current bool   `json:"current"` // caught up with the leader
	Offline bool   `json:"offline,omitempty"`
	Lag     uint64 `json:"lag"` // operations behind the leader
}

NatsReplica is one copy of a stream on another server.

type NatsSent

type NatsSent struct {
	Subject   string  `json:"subject"`
	Stream    string  `json:"stream"`
	Sequence  *uint64 `json:"sequence"` // null on a dry run
	Duplicate bool    `json:"duplicate,omitempty"`
}

NatsSent is where a published message went.

type NatsStream

type NatsStream struct {
	Subjects      []string `json:"subjects"`
	Bytes         uint64   `json:"bytes"`
	ConsumerCount int      `json:"consumer_count"`
	Storage       string   `json:"storage"`   // file or memory
	Retention     string   `json:"retention"` // limits, interest or workqueue
	NumReplicas   int      `json:"num_replicas"`
	FirstSeq      uint64   `json:"first_seq"`
	LastSeq       uint64   `json:"last_seq"`
	Sealed        bool     `json:"sealed,omitempty"`
}

NatsStream is what `queue ls` shows of a JetStream stream.

type NatsStreamDetail

type NatsStreamDetail struct {
	NatsStream
	Description  string         `json:"description,omitempty"`
	Discard      string         `json:"discard"` // old or new: what goes when a limit is reached
	Limits       NatsLimits     `json:"limits"`
	FirstTime    *time.Time     `json:"first_time,omitempty"`
	LastTime     *time.Time     `json:"last_time,omitempty"`
	NumDeleted   int            `json:"num_deleted"` // holes between first_seq and last_seq
	NumSubjects  uint64         `json:"num_subjects"`
	DenyDelete   bool           `json:"deny_delete,omitempty"`
	DenyPurge    bool           `json:"deny_purge,omitempty"`
	Created      time.Time      `json:"created"`
	Cluster      *NatsCluster   `json:"cluster,omitempty"`
	Mirror       string         `json:"mirror,omitempty"`
	Sources      []string       `json:"sources,omitempty"`
	ConsumerInfo []NatsConsumer `json:"consumer_info"`
}

NatsStreamDetail is what `queue describe` shows of a stream.

type OpenFunc

type OpenFunc func(ctx context.Context, t driver.Target, password string, dial DialFunc, timeout time.Duration, clientID string) (Queue, error)

OpenFunc connects to a conn of one engine and checks that it answers.

type Partition

type Partition struct {
	ID       int32   `json:"id"`
	Leader   int32   `json:"leader"` // -1: no leader (offline)
	Replicas []int32 `json:"replicas"`
	ISR      []int32 `json:"in_sync"`
	Start    int64   `json:"start_offset"`
	End      int64   `json:"end_offset"`
	Messages int64   `json:"messages"`
	Error    string  `json:"error,omitempty"`
}

Partition is one partition of a topic.

type PartitionLag

type PartitionLag struct {
	Topic     string `json:"topic"`
	Partition int32  `json:"partition"`
	Committed int64  `json:"committed"` // -1: nothing committed yet
	End       int64  `json:"end_offset"`
	Lag       int64  `json:"lag"` // -1 when it cannot be worked out (see error)
	Member    string `json:"member,omitempty"`
	Client    string `json:"client_id,omitempty"`
	Host      string `json:"client_host,omitempty"`
	Error     string `json:"error,omitempty"`
}

PartitionLag is where a group is in one partition.

type PeekOptions

type PeekOptions struct {
	Topic     string
	Limit     int   // how many messages, over all partitions
	Oldest    bool  // the first ones still kept, not the newest
	Partition int32 // -1: every partition
	MaxBytes  int   // a longer key or value is cut (0: no limit)
	Wait      time.Duration
}

PeekOptions say which messages `queue peek` reads.

type PeekResult

type PeekResult struct {
	Topic  string `json:"topic,omitempty"`  // kafka
	Queue  string `json:"queue,omitempty"`  // rabbitmq, sqs
	Stream string `json:"stream,omitempty"` // nats
	// pubsub: messages are read from a subscription
	Subscription string     `json:"subscription,omitempty"`
	From         string     `json:"from"` // newest | oldest (kafka, nats) | front (rabbitmq) | sample (sqs) | pulled (pubsub)
	Messages     []Received `json:"messages"`
	Count        int        `json:"count"`
	More         bool       `json:"more"` // the topic holds more than these
	Partial      bool       `json:"partial,omitempty"`
	Requeued     bool       `json:"requeued,omitempty"` // rabbitmq: the messages went back to the queue, marked redelivered; pubsub: given back unacknowledged
	// rabbitmq quorum queues: after this many deliveries the queue drops
	// (or dead-letters) a message, and every peek counts as one; sqs: the
	// receives after which a message goes to the dead-letter queue; pubsub:
	// the deliveries after which it goes to the dead-letter topic
	DeliveryLimit int `json:"delivery_limit,omitempty"`
}

PeekResult is what `queue peek` read.

type PubsubCreated

type PubsubCreated struct {
	FullName string            `json:"full_name"`
	OfTopic  string            `json:"of_topic,omitempty"` // a subscription: its topic
	Settings map[string]string `json:"settings,omitempty"`
}

PubsubCreated is the topic or subscription `queue create` made.

type PubsubDetail

type PubsubDetail struct {
	Resource         string               `json:"resource"`  // topic or subscription
	FullName         string               `json:"full_name"` // projects/P/topics/T or projects/P/subscriptions/S
	Labels           map[string]string    `json:"labels,omitempty"`
	MessageRetention string               `json:"message_retention,omitempty"` // topic: how long it keeps messages itself
	KmsKey           string               `json:"kms_key_name,omitempty"`
	Schema           string               `json:"schema,omitempty"`
	AllowedRegions   []string             `json:"allowed_regions,omitempty"`
	SubscriptionInfo []PubsubSubscription `json:"subscription_info,omitempty"` // topic: its subscriptions
	*PubsubSubscription
}

PubsubDetail is what `queue describe` shows of a topic or a subscription; Resource says which. A subscription's own settings are in the embedded PubsubSubscription.

type PubsubInfo

type PubsubInfo struct {
	Project           string `json:"project"`
	APIEndpoint       string `json:"api_endpoint"` // the server komando talks to (host:port)
	TopicCount        int    `json:"topic_count"`
	SubscriptionCount int    `json:"subscription_count"`
}

PubsubInfo is what `queue info` shows of one Google Cloud project.

type PubsubMessage

type PubsubMessage struct {
	ID              string     `json:"id"`
	PublishTime     *time.Time `json:"publish_time,omitempty"`
	OrderingKey     string     `json:"ordering_key,omitempty"`
	DeliveryAttempt int        `json:"delivery_attempt,omitempty"` // only with a dead-letter topic: deliveries so far, this peek included
}

PubsubMessage is what peek read about one Pub/Sub message.

type PubsubSent

type PubsubSent struct {
	ID          *string `json:"id"` // null on a dry run
	OrderingKey string  `json:"ordering_key,omitempty"`
}

PubsubSent is what Pub/Sub said about a message `queue send` published.

type PubsubSubscription

type PubsubSubscription struct {
	Subscription        string `json:"subscription"` // its short name
	Topic               string `json:"topic"`        // the topic it gets messages from; _deleted-topic_ when that is gone
	Delivery            string `json:"delivery"`     // pull, push, bigquery or cloud-storage
	PushEndpoint        string `json:"push_endpoint,omitempty"`
	AckDeadline         int    `json:"ack_deadline_seconds"` // how long a pulled message stays hidden before it is given out again
	BacklogRetention    string `json:"backlog_retention"`    // how long a message nobody acknowledged is kept
	RetainAcked         bool   `json:"retain_acked"`         // acknowledged messages are kept too (for seek)
	Ordering            bool   `json:"ordering"`             // messages with the same ordering key arrive in order
	ExactlyOnce         bool   `json:"exactly_once"`
	Filter              string `json:"filter,omitempty"`
	DeadLetterTopic     string `json:"dead_letter_topic,omitempty"`
	MaxDeliveryAttempts int    `json:"max_delivery_attempts,omitempty"` // deliveries before a message goes to the dead-letter topic
	Detached            bool   `json:"detached,omitempty"`
	SubscriptionState   string `json:"subscription_state,omitempty"` // active, or resource_error when it cannot deliver
}

PubsubSubscription is one subscription: in `describe` (a topic's subscriptions, or one subscription) and in `groups`, where each subscription is a line. Every subscription gets every message of its topic; the programs that pull from one share its messages.

type PubsubTopic

type PubsubTopic struct {
	SubscriptionCount int    `json:"subscription_count"`
	MessageRetention  string `json:"message_retention,omitempty"` // how long the topic itself keeps messages (for seek); "": it does not
}

PubsubTopic is what `queue ls` shows of a Pub/Sub topic.

type Purged

type Purged struct {
	Topic  string `json:"topic,omitempty"`  // kafka
	Queue  string `json:"queue,omitempty"`  // rabbitmq, sqs
	Stream string `json:"stream,omitempty"` // nats
	// pubsub: the subscription emptied
	Subscription string `json:"subscription,omitempty"`
	Messages     int64  `json:"messages"`             // -1: not known (pubsub)
	Partitions   int    `json:"partitions,omitempty"` // kafka
	InFlight     *int64 `json:"in_flight,omitempty"`  // sqs: received and not yet deleted; purge deletes these too
	DryRun       bool   `json:"dry_run,omitempty"`
}

Purged is what `queue purge` removed (or would).

type Queue

type Queue interface {
	Info(ctx context.Context) (*Info, error)
	Topics(ctx context.Context, pattern string, internal bool) ([]Topic, error)
	Describe(ctx context.Context, topic string) (*TopicDetail, error)
	Peek(ctx context.Context, o PeekOptions) (*PeekResult, error)
	Groups(ctx context.Context) ([]Group, error)
	Lag(ctx context.Context, group string) (*GroupLag, error)
	Send(ctx context.Context, m Message, dryRun bool) (*Sent, error)
	Create(ctx context.Context, s TopicSpec, dryRun bool) (*Created, error)
	Delete(ctx context.Context, topics []string, dryRun bool) ([]Deleted, error)
	Purge(ctx context.Context, topic string, dryRun bool) (*Purged, error)
	Close()
}

Queue is what the queue commands need from an engine.

func Open

func Open(ctx context.Context, t driver.Target, password string, dial DialFunc, timeout time.Duration, clientID string) (Queue, error)

Open connects to a queue conn and checks that a broker answers.

type RabbitConsumer

type RabbitConsumer struct {
	Tag         string `json:"tag"`
	Connection  string `json:"connection,omitempty"` // the client's address or connection name
	User        string `json:"user,omitempty"`
	AckRequired bool   `json:"ack_required"`
	Prefetch    int    `json:"prefetch"`
	Active      bool   `json:"active"`
}

RabbitConsumer is one consumer of a queue (management API).

type RabbitCreated

type RabbitCreated struct {
	Type      string         `json:"type,omitempty"` // "": the vhost's default type
	Durable   bool           `json:"durable"`
	Vhost     string         `json:"vhost"`
	Arguments map[string]any `json:"arguments,omitempty"`
}

RabbitCreated is the RabbitMQ queue made.

type RabbitDelivery

type RabbitDelivery struct {
	Redelivered bool              `json:"redelivered"`          // it had been delivered before this peek
	Deliveries  int64             `json:"deliveries,omitempty"` // quorum queues: times handed out and given back, this peek included
	Exchange    string            `json:"exchange"`             // "" is the default exchange
	RoutingKey  string            `json:"routing_key"`
	Properties  map[string]string `json:"properties,omitempty"` // content_type, message_id, timestamp ...
}

RabbitDelivery is a message `queue peek` took from the front of a RabbitMQ queue and gave back.

type RabbitInfo

type RabbitInfo struct {
	Product    string        `json:"product,omitempty"` // RabbitMQ, or the name a compatible server gives
	Cluster    string        `json:"cluster,omitempty"` // the cluster's name
	Vhost      string        `json:"vhost"`
	User       string        `json:"user,omitempty"`
	Platform   string        `json:"platform,omitempty"` // the Erlang version
	Management bool          `json:"management"`         // whether the management API was asked (?management=PORT)
	Nodes      []RabbitNode  `json:"nodes,omitempty"`    // management: the cluster's nodes
	Totals     *RabbitTotals `json:"totals,omitempty"`   // management: counts over the whole cluster
}

RabbitInfo is what `queue info` shows of a RabbitMQ server.

type RabbitNode

type RabbitNode struct {
	Name    string `json:"name"`
	Running bool   `json:"running"`
	Type    string `json:"type,omitempty"` // disc or ram
}

RabbitNode is one node of a RabbitMQ cluster.

type RabbitQueue

type RabbitQueue struct {
	Type      string `json:"type"` // classic, quorum or stream
	Durable   bool   `json:"durable"`
	Ready     int64  `json:"ready"`   // waiting for a consumer
	Unacked   int64  `json:"unacked"` // given to a consumer, not yet acknowledged
	Consumers int    `json:"consumers"`
	State     string `json:"state,omitempty"` // running, idle, flow, down ...
}

RabbitQueue is what `queue ls` shows of a RabbitMQ queue.

type RabbitQueueDetail

type RabbitQueueDetail struct {
	Vhost      string           `json:"vhost"`
	Management bool             `json:"management"`
	Ready      int64            `json:"ready"`
	Unacked    *int64           `json:"unacked,omitempty"`
	Consumers  int              `json:"consumers"`
	Type       string           `json:"type,omitempty"`
	Durable    *bool            `json:"durable,omitempty"`
	AutoDelete bool             `json:"auto_delete,omitempty"`
	Exclusive  bool             `json:"exclusive,omitempty"`
	State      string           `json:"state,omitempty"`
	Node       string           `json:"node,omitempty"`
	Policy     string           `json:"policy,omitempty"`
	Arguments  map[string]any   `json:"arguments,omitempty"`
	ConsumerOf []RabbitConsumer `json:"consumer_details,omitempty"`
}

RabbitQueueDetail is what `queue describe` shows of a RabbitMQ queue. Without the management API only Ready and Consumers are known.

type RabbitTotals

type RabbitTotals struct {
	Queues      int   `json:"queues"`
	Exchanges   int   `json:"exchanges"`
	Connections int   `json:"connections"`
	Channels    int   `json:"channels"`
	Consumers   int   `json:"consumers"`
	Messages    int64 `json:"messages"`
	Ready       int64 `json:"ready"`
	Unacked     int64 `json:"unacked"`
}

RabbitTotals are the management API's counts, over every vhost.

type Received

type Received struct {
	*KafkaRecord
	*RabbitDelivery
	*NatsMsg
	*SqsMessage
	*PubsubMessage
	Value          string            `json:"value"`
	Encoding       string            `json:"encoding,omitempty"` // base64 when the value is not UTF-8 text
	Size           int               `json:"size"`               // the value's size in bytes
	ValueTruncated bool              `json:"value_truncated,omitempty"`
	Headers        map[string]string `json:"headers,omitempty"`
}

Received is one message read; the engine's part says where it was: a Kafka partition, the front of a RabbitMQ queue, a NATS stream, an SQS queue or a Pub/Sub subscription.

type Sent

type Sent struct {
	Topic string `json:"topic,omitempty"` // kafka
	Queue string `json:"queue,omitempty"` // rabbitmq, sqs
	*KafkaSent
	*NatsSent
	*SqsSent
	*PubsubSent
	Size   int  `json:"size"`
	DryRun bool `json:"dry_run,omitempty"`
}

Sent is where a message went (or, with dry run, would go).

type SqsCreated

type SqsCreated struct {
	URL        string            `json:"url,omitempty"` // empty on a dry run
	Fifo       bool              `json:"fifo"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

SqsCreated is the SQS queue `queue create` made.

type SqsInfo

type SqsInfo struct {
	Region    string `json:"region"`
	Endpoint  string `json:"endpoint"`             // the server komando talks to (host:port)
	AccountID string `json:"account_id,omitempty"` // the account that owns the queues, from their URLs or ?account=
	Queues    int    `json:"queues"`
}

SqsInfo is what `queue info` shows of one region of an AWS account.

type SqsMessage

type SqsMessage struct {
	MessageID       string     `json:"message_id"`
	SentAt          *time.Time `json:"sent_at,omitempty"`
	ReceiveCount    int        `json:"receive_count"` // times received, this peek included
	FirstReceivedAt *time.Time `json:"first_received_at,omitempty"`
	MessageGroupID  string     `json:"message_group_id,omitempty"` // fifo
	SequenceNumber  string     `json:"sequence_number,omitempty"`  // fifo
	DeduplicationID string     `json:"deduplication_id,omitempty"` // fifo
}

SqsMessage is what peek read about one SQS message.

type SqsQueue

type SqsQueue struct {
	Fifo            bool   `json:"fifo"`
	InFlight        int64  `json:"in_flight"` // received by a consumer, not yet deleted (hidden for their visibility timeout)
	Delayed         int64  `json:"delayed"`   // sent with a delay that has not passed yet
	DeadLetterQueue string `json:"dead_letter_queue,omitempty"`
	MaxReceiveCount int    `json:"max_receive_count,omitempty"` // receives before a message goes to the dead-letter queue
}

SqsQueue is what `queue ls` shows of an SQS queue. Messages (in Topic) are the ones waiting to be received.

type SqsQueueDetail

type SqsQueueDetail struct {
	SqsQueue
	URL               string            `json:"url"`
	ARN               string            `json:"arn"`
	VisibilityTimeout int               `json:"visibility_timeout"` // seconds a received message stays hidden
	RetentionSeconds  int               `json:"retention_seconds"`  // how long SQS keeps a message
	DelaySeconds      int               `json:"delay_seconds"`
	MaxMessageSize    int               `json:"max_message_size"` // bytes
	ReceiveWait       int               `json:"receive_wait"`     // seconds a receive waits for messages (long polling)
	ContentDedup      bool              `json:"content_dedup"`    // fifo: the body's hash is the deduplication ID
	Encryption        string            `json:"encryption"`       // none, sqs-managed or kms:KEY
	CreatedAt         *time.Time        `json:"created_at,omitempty"`
	ModifiedAt        *time.Time        `json:"modified_at,omitempty"`
	DeadLetterSources []string          `json:"dead_letter_sources"` // queues whose dead-letter queue this is
	Tags              map[string]string `json:"tags,omitempty"`
	Attributes        map[string]string `json:"attributes,omitempty"` // the other settings, as SQS names them
}

SqsQueueDetail is what `queue describe` shows of an SQS queue.

type SqsSent

type SqsSent struct {
	MessageID      *string `json:"message_id"` // null on a dry run
	MessageGroupID string  `json:"message_group_id,omitempty"`
	SequenceNumber string  `json:"sequence_number,omitempty"` // fifo
}

SqsSent is what SQS said about a message `queue send` sent.

type Topic

type Topic struct {
	Name     string `json:"name"`
	Messages int64  `json:"messages"` // kafka: end minus start offset, an upper bound on compacted topics
	*KafkaTopic
	*RabbitQueue
	*NatsStream
	*SqsQueue
	*PubsubTopic
}

Topic is one line of `queue ls`: a Kafka or Pub/Sub topic, a RabbitMQ or SQS queue, or a NATS JetStream stream.

type TopicDetail

type TopicDetail struct {
	Name     string `json:"name"`
	Messages int64  `json:"messages"`
	*KafkaTopicDetail
	*RabbitQueueDetail
	*NatsStreamDetail
	*SqsQueueDetail
	*PubsubDetail
}

TopicDetail is `queue describe`: the engine's part says more about the topic, queue, stream or (Pub/Sub) subscription.

type TopicSpec

type TopicSpec struct {
	Topic      string
	Partitions int32  // kafka; -1: the broker's default
	Replicas   int16  // kafka; -1: the broker's default
	Type       string // rabbitmq: classic, quorum or stream ("": the server's default)
	// nats: Replicas is the stream's copies, Config its settings
	// (subjects, storage, retention, max_age ...)
	Config map[string]string
}

TopicSpec is a topic (or queue) `queue create` makes.

Directories

Path Synopsis
Package nats is the NATS JetStream engine of `komando queue`, through github.com/nats-io/nats.go.
Package nats is the NATS JetStream engine of `komando queue`, through github.com/nats-io/nats.go.
Package pubsub is the Google Cloud Pub/Sub engine of `komando queue`.
Package pubsub is the Google Cloud Pub/Sub engine of `komando queue`.
Package rabbitmq is the RabbitMQ engine of `komando queue` (AMQP 0-9-1, through github.com/rabbitmq/amqp091-go).
Package rabbitmq is the RabbitMQ engine of `komando queue` (AMQP 0-9-1, through github.com/rabbitmq/amqp091-go).
Package sqs is the Amazon SQS engine of `komando queue`.
Package sqs is the Amazon SQS engine of `komando queue`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL