Queue commands
The nova commands that list and show queues, purge their messages, and replay their dead letters.
The queue commands look after queues that an application
created. They list a bucket's queues, print one queue's settings and where it
is served, remove every message, and send dead letters back. A dead letter
is a message that used up its attempts, or that a worker gave up on. The CLI
cannot create, change, or delete a queue, or send and claim messages. Use an
SDK or the API for those. Each
command needs a server address from --addr or NOVA_ADDR, as
Connect explains.
export NOVA_ADDR=localhost:7781| Command | Does | Grant |
|---|---|---|
nova queue list | Pages through a bucket's queues | list |
nova queue get | Prints a queue's settings, open ranges, and the nodes that deliver them | read |
nova queue purge | Removes every message, without asking | trim |
nova queue replay-dead-letters | Sends the oldest dead letters to the queue again | append |
The examples ran on a four-node cluster, so the delivering nodes are
127.0.0.1:8351 to 127.0.0.1:8354. Every command here takes
--output json; see Output for its shape.
nova queue list
Prints one page of a bucket's queues, in key order.
nova queue list [options] <bucket | nova://bucket>List a bucket's queues
nova queue list demoADDRESS KIND CLAIMS RANGES DISPATCHERS
nova://demo/emails standard memory 1 1
nova://demo/ledger key_ordered persisted 2 2KIND is standard or key_ordered, and CLAIMS says whether claims live in
the delivering node's memory or are persisted. RANGES counts open
ranges, and DISPATCHERS counts the distinct nodes delivering them.
Page through the queues
nova queue list demo --limit 1ADDRESS KIND CLAIMS RANGES DISPATCHERS
nova://demo/emails standard memory 1 1
Next cursor: 01a2048d-60e4-70cb-acb1-f3987a55c0e4 (pass with --cursor)Pass the cursor back as printed. --prefix led keeps only queues whose key
starts with led. A bucket with no queues prints No queues found.. With
--output json, each item carries every setting queue get prints, in
milliseconds, and the page ends with next_cursor.
The concept is Queues. The same task is List queues with an SDK and List a bucket's queues over the API.
nova queue get
Prints one queue's settings, its open ranges, and the node delivering each.
nova queue get [options] <nova://bucket/key>Show a queue
nova queue get nova://demo/emailsnova://demo/emails
Kind: standard
Claims: memory
Dedup: memory
Concurrency: unbounded
Key concurrency: unbounded
Claim ttl: 30s
Message ttl: 96h0m0s
Dead-letter ttl: 336h0m0s
Max attempts: 3
Retry wait: 1s, then ×2 each time, at most 1m0s
Dead-letter range: 01a2048d-60e4-70e6-b203-ee23bb76a12f
Dispatchers: 127.0.0.1:8354
Ranges: 1 open
01a2048d-60e5-7547-a7fe-122892688bc7 127.0.0.1:8354Retry wait is the wait before the second attempt, how it grows, and its
longest value. The last lines name each open range and the address of the
node that delivers its messages. Use them to find which node's logs to read
when one range lags.
A stream address fails with exit code 1:
nova: client: stream not found: star: not a queue: demo/ordersThe concept is Queues, and Queue settings lists every setting. The same task is Read a queue with an SDK and Get a queue over the API.
nova queue purge
Removes every message from a queue. The queue, its settings, and its dead letters stay.
nova queue purge [options] <nova://bucket/key>Purge a queue
nova queue purge nova://demo/emailspurged nova://demo/emails: 4 messages removedAfter one more message was sent, a second purge with --output json:
{
"action": "purged",
"address": "nova://demo/emails",
"purged": 1
}The command does not ask for confirmation. Use it to drop a backlog you no
longer want, such as messages a bad release sent. A purge visits every open
range. When one range's node cannot be reached, the command fails with
nova: purge of <address>: removed <n> messages before failing: and the
cause. Run it again once the node is back. A second purge removes only what
is left.
A purge can need the admin grant
When a range's messages are stored on a different node from the one that
delivers them, the purge fails with
PermissionDenied … admin verb requires the nova:admin marker, even with a
trim grant. Run it with a token that holds nova:admin.
The concept is Queues. The same task is Purge a queue with an SDK and Purge a queue over the API.
nova queue replay-dead-letters
Sends a queue's oldest dead letters to the queue again. Each starts over as a first attempt.
nova queue replay-dead-letters [options] <nova://bucket/key>Replay the dead letters
After you fix what made the messages fail:
nova queue replay-dead-letters nova://demo/emails --limit 100replayed 1 dead letters to nova://demo/emailsReplay every dead letter, in a script
nova queue replay-dead-letters --output json nova://demo/emails{
"action": "replayed",
"address": "nova://demo/emails",
"replayed": 0,
"more": false
}more is true while dead letters remain, so a script repeats the command
until it is false. Each run takes at most --limit, oldest first, and
removes the ones it sent from the dead letters. This loop replays them all:
while nova queue replay-dead-letters --output json nova://demo/emails \
| jq -e .more > /dev/null; do :; doneIt prints nothing. It stops after the run that prints "more":false, and also
when the command fails, because jq then reads no input.
A failed replay sends the same messages again
The dead letters can be stored on a different node from the one that delivers
the queue. Then the replay sends them and fails with
PermissionDenied … admin verb requires the nova:admin marker, even with an
append grant. The messages it sent stay in the dead letters, so running it
again sends them a second time. Run it with a token that holds nova:admin.
The concept is Delivery and claims. The same task is Replay dead letters with an SDK and Replay dead letters over the API.