项目作者: yongfei25

项目描述 :
A command line tool for interacting with AWS SQS queues :walking::walking::walking:
高级语言: TypeScript
项目地址: git://github.com/yongfei25/sqsc.git
创建时间: 2017-07-06T14:30:33Z
项目社区:https://github.com/yongfei25/sqsc

开源协议:

下载


sqsc

npm version
Build Status

sqsc is a command line tool for interacting with AWS SQS queues.

Installation

  1. npm install -g sqsc

Features

List queues: sqsc lq [queue-prefix]

list queue

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.

list messages

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).

list messages

Describe queue: sqsc describe <queue-name>

describe

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 like jq)

3. To see what queues are available for query, run sqsc list-table.

4. To see the table schema, run sqsc schema.

query

5. To query fields in JSON, use json_extract function in sqlite.

  1. $ sqsc query "select json_extract(body, '$.gender') gender, count(*) from DevelopmentQueue group by 1"
  2. GENDER COUNT(*)
  3. Female 24
  4. Male 26

Message visibility timeout and max receive count

  • When a message is received by sqsc, the visibility timeout is set to 30s by default. You can use the --timeout parameter to change it.
  • sqsc keeps the receipt handle for all messages to reset their visibility timeout at the end of the command.
  • If sqsc receive the same message more than once, it will only use the first message. (It checks message ID)
  • receive count of message increases as usual for each receive. Message goes into dead letter queue when it hits max receive count.
  • The following commands receive message thus have the effects mentioned above:
    • ls
    • mv
    • cp
    • pull

Unsupported Features

  • Server side encryption
  • FIFO queue

Development Setup

  1. # Install dependencies
  2. npm install
  3. # Running tests
  4. npm test
  5. # Starting localstack
  6. export TMPDIR=/private$TMPDIR # MacOS only
  7. docker-compose up -d
  8. # Populating queues and messages for Development
  9. export LOCALSTACK=1
  10. tsc -p .
  11. bin/populate-dev.js