ctl

command
v0.1.0-dev4 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 9 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.

README

Queue Admin CLI

Admin CLI for inspecting, managing, and troubleshooting the MySQL-backed message queue. Operates directly on the queue database tables (queue_messages, queue_offsets, queue_partition_leases).

Setup

Start the local stack and find the MySQL queue port:

make local-start
make local-ps   # note the MySQL Queue port

Set the DSN once for the session:

export QUEUE_MYSQL_DSN="root:root@tcp(localhost:<PORT>)/submitqueue"

Or pass --dsn on every command.

Running

Via Make (uses Bazel):

make run-queue-admin ARGS="list-topics"
make run-queue-admin ARGS="topic-stats --topic merge_queue"

Via Bazel directly:

bazel run //extension/queue/mysql/ctl -- list-topics
bazel run //extension/queue/mysql/ctl -- topic-stats --topic merge_queue

Commands

Inspect Topics
# List all topics with message counts
queue-admin list-topics

# Detailed stats for a topic (total messages, DLQ count, partitions, consumer groups)
queue-admin topic-stats --topic merge_queue
Inspect Messages
# List messages (default limit 50)
queue-admin list-messages --topic merge_queue

# Filter by partition, custom limit
queue-admin list-messages --topic merge_queue --partition uber/cadence --limit 10

# Full message details including payload and metadata
queue-admin inspect-message --topic merge_queue --message-id msg-123
Manage Messages

Destructive commands prompt for confirmation by default. Use --no-interactive to skip prompts (for scripting).

# Delete a single message
queue-admin delete-message --topic merge_queue --message-id msg-123

# Purge all messages from a topic
queue-admin purge-topic --topic merge_queue

# Skip confirmation prompt (for scripting)
queue-admin purge-topic --topic merge_queue --no-interactive
Dead Letter Queue (DLQ)

DLQ messages live in the same queue_messages table under topic + "_dlq" (default suffix).

# List DLQ messages
queue-admin list-dlq --topic merge_queue

# Inspect a DLQ message (use the DLQ topic name)
queue-admin inspect-message --topic merge_queue_dlq --message-id msg-456

# Move a DLQ message back to the original topic
queue-admin requeue-dlq --topic merge_queue --message-id msg-456

# Purge all DLQ messages
queue-admin purge-dlq --topic merge_queue

# Custom DLQ suffix (if not using default "_dlq")
queue-admin list-dlq --topic merge_queue --dlq-suffix _dead
Consumer Lag
# Per-partition lag for all consumer groups on a topic
queue-admin consumer-lag --topic merge_queue

Output shows ACKED (last processed offset), LATEST (newest message offset), and LAG (unprocessed count) per partition per consumer group.

Consumer Offsets
# List all consumer group offsets
queue-admin list-offsets

# Filter by consumer group
queue-admin list-offsets --consumer-group orchestrator

# Reset offset to 0 (reprocess all messages)
queue-admin reset-offset --consumer-group orchestrator --topic merge_queue --partition uber/cadence

# Reset to a specific offset
queue-admin reset-offset --consumer-group orchestrator --topic merge_queue --partition uber/cadence --offset 42
Partition Leases
# List all active partition leases (who owns what)
queue-admin list-leases

# Find stale leases (not renewed within threshold, likely dead workers)
queue-admin stale-leases                    # default 60s threshold
queue-admin stale-leases --threshold 30000  # 30s threshold

# Force-release a stuck lease
queue-admin release-lease --consumer-group orchestrator --topic merge_queue --partition uber/cadence
JSON Output

Add --json to any read command for machine-readable output:

queue-admin list-topics --json
queue-admin consumer-lag --topic merge_queue --json
queue-admin list-messages --topic merge_queue --json | jq '.[] | .ID'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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