0.0.9 • Published 8 years ago
sqsc v0.0.9
sqsc
sqsc is a command line tool for interacting with AWS SQS queues.
Installation
npm install -g sqscFeatures
List queues: sqsc lq [queue-prefix]

List messages: sqsc ls <queue-name>
Options:
timeout: Visibility timeout for messages received (Default = 30). You might need to increase this if the queue has a lot of messages to prevent reading the same message.timestamp: Display timestamp.limit: Maximum number of messages to list.

Copy all messages to queue: sqsc cp <from-queue-name> <to-queue-name>
Move all messages to queue: sqsc mv <from-queue-name> <to-queue-name>
Options:
timeout: Visibility timeout for messages received (Default = 30).

Describe queue: sqsc describe <queue-name>

SQL query: sqsc query "SELECT body FROM <queue-name> WHERE body LIKE '%user%'"
1. Run sqsc pull <queue-name> to store messages in local sqlite database.
Options:
timeout: Visibility timeout for messages received (Default = 30).
2. To query, run sqsc query <sql-query>. Internally, sqsc will try to guess the queue name in the SQL.
Options:
hide-headers: Do not show column headers. (Eg: you want to use body with JSON parser likejq)
3. To see what queues are available for query, run sqsc list-table.
4. To see the table schema, run sqsc schema.

5. To query fields in JSON, use json_extract function in sqlite.
$ sqsc query "select json_extract(body, '$.gender') gender, count(*) from DevelopmentQueue group by 1"
GENDER COUNT(*)
Female 24
Male 26Message visibility timeout and max receive count
- When a message is received by
sqsc, thevisibility timeoutis set to30sby default. You can use the--timeoutparameter to change it. sqsckeeps thereceipt handlefor all messages to reset theirvisibility timeoutat the end of the command.- If
sqscreceive the same message more than once, it will only use the first message. (It checksmessage ID) receive countof message increases as usual for each receive. Message goes intodead letter queuewhen it hitsmax receive count.- The following commands receive message thus have the effects mentioned above:
lsmvcppull
Unsupported Features
- Server side encryption
- FIFO queue
Development Setup
# Install dependencies
npm install
# Running tests
npm test
# Starting localstack
export TMPDIR=/private$TMPDIR # MacOS only
docker-compose up -d
# Populating queues and messages for Development
export LOCALSTACK=1
tsc -p .
bin/populate-dev.js