I have a redis queue and node app that is inserting items into the queue. They are just JSON strings. I'm using the bee-queue npm package for this.
For the purposes of debugging, it would be nice if there was way to see the items currently in the queue waiting to be processed using the redis cli?
127.0.0.1:6379> keys *
1) "bq:myqueue:waiting"
2) "bq:myqueue:jobs"
3) "bq:myqueue:id"
I can see there are items in there
127.0.0.1:6379> llen bq:myqueue:waiting
(integer) 2
but I can't seem to actually view them:
127.0.0.1:6379> get bq:myqueue:waiting
(error) WRONGTYPE Operation against a key holding the wrong kind of value
When I use LRANGE
to list the data, I get this:
127.0.0.1:6379> LRANGE bq:myqueue:waiting 0 3
1) "9"
2) "8"
3) "7"
Based on the data I'm seeing when using the node.js client to process these items, those are the ids that redis is assigning to the items in the queue, but it's not the JSON data I am actually putting in the queue.
Looks like Adam Marshall had the right idea in checking the type. It turns out that bq:myqueue:jobs
is a hash so you can use the hash commands for exploring the contents. For example
127.0.0.1:6379> TYPE bq:myqueue:jobs
hash
127.0.0.1:6379> HGKEYS bq:myqueue:jobs
1) "11"
2) "9"
3) "4"
127.0.0.1:6379> HGET bq:myqueue:jobs "4"
"{"data":{"a":1001, "b": "four"},"options":{"timestamp":1632162180724,"stacktraces":[]},"status":"created","progress":0}"
127.0.0.1:6379> HGETALL bq:myqueue:jobs
1) "11"
2) "{"data":{"a":1, "b": "two"},"options":{"timestamp":1632162260037,"stacktraces":[]},"status":"created","progress":0}"
3) "9"
4) "{"data":{"a":99, "b": "three"},"options":{"timestamp":1632189454151,"stacktraces":[]},"status":"created","progress":0}"
5) "4"
6) "{"data":{"a":1001, "b": "four"},"options":{"timestamp":1632162180724,"stacktraces":[]},"status":"created","progress":0}"
The formatting leaves a bit to be desired but I think that basically works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With