sqscat

command module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 17 Imported by: 0

README

sqscat

Go Report Card MIT license

sqscat is "netcat for SQS". You can use sqscat to receive from and send messages to SQS queue. sqscat uses newline as the delimiter between messages.

sqscat automatically detects and selects its mode (receive/send) depending on the terminal or pipe type:

  • If data is being piped into sqscat (stdin), it sends messages to SQS.
  • If data is being piped from sqscat (stdout), it receives messages from SQS.

sqscat is inspired by kafkacat.

Install

You can download built binaries for Mac, Linux and Windows from the releases page.

Usage

Note: sqscat uses AWS SDK which will automatically load access and region configuration from environment variables, AWS shared configuration file (~/.aws/config), and AWS shared credentials file (~/.aws/credentials).

$ sqscat --help
Usage:
  sqscat [OPTIONS] queue-name

Application Options:
  -v, --version       Print version and exit
  -c, --concurrency=  Number of concurrent SQS receivers/senders; Defaults to 10 x Num. of CPUs
  -d, --delete        Delete received messages
  -n, --num-messages= Receive/send specified number of messages and exit; This limits concurrency to 1
  -t, --timeout=      Exit after specified number of seconds

Help Options:
  -h, --help          Show this help message
Examples

Receive mode:

Keep reading json payloads from queue and extract individual fields using jq:

$ sqscat my-sqs-queue | jq --unbuffered '.employee.email'

Read 25 messages from queue and exit:

$ sqscat -n 25 my-sqs-queue

Keep reading from queue for 10 seconds and exit:

$ sqscat -t 10 my-sqs-queue

Delete received messages after they have been printed to stdout:

$ sqscat -d my-sqs-queue

Send mode:

Parse json and keep sending messages to the queue. sqscat will exit after the input pipe has been closed (EOF).

$ cat employees.json | jq --unbuffered '.employee.email' | ./sqscat dev-ppai-temp

Send 25 messages to the queue and exit:

$ cat employees.json | jq --unbuffered '.employee.email' | sqscat -n 25 my-sqs-queue

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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