Skip to content

CLI to bring your messages back from SQS Dead Letter Queues.

License

Notifications You must be signed in to change notification settings

renanvieira/phoenix-letter

Repository files navigation

Phoenix Letter pypi

Code style: black Build Status License: MIT

Bring your messages back from Dead Letter Queue with this command line script that helps you moving messages from DLQ back to the main queue for reprocessing SQS queues. It also can be used to move messages between queues in SQS.

Install

Manually

  • Mac/Linux: python3 setup.py install
  • Windows: py setup.py install

PyPi

  • pip install phoenix_letter

Usage

After installation you will have a command with the following params:

$   phoenix_letter --help
usage: phoenix_letter [-h] --src SOURCE_QUEUE --dst DESTINATION_QUEUE [--aws-keys] --region REGION [--empty-receive EMPTY_RECEIVE] [--max N] [--max-per-request N]

optional arguments:
  -h, --help            show this help message and exit
  --src SOURCE_QUEUE    Source SQS Queue Name
  --dst DESTINATION_QUEUE
                        Destination SQS Queue Name
  --aws-keys            Flag that indicates you want to enter custom AWS keys.
  --region REGION       AWS Region
  --empty-receive EMPTY_RECEIVE
                        Max number of empty receives before giving up
  --max N               Max number of messages to process from the source queue.
  --max-per-request N   Max number of messages to received from the source queue per request (this will be pass in the MaxNumberOfMessages param). Default: 10 (AWS API max limit)
  --fifo                Flag that indicates you want to interact with a FIFO queue.
  --group-id MESSAGE_GROUP_ID
                        Value for the MessageGroupId (used in FIFO queues). Required if '--fifo' argument is passed. Default: NULL.
  • --src: Source Queue Name
  • --dst: Destination Queue Name
  • --aws-keys: [OPTIONAL] The CLI will prompt you to enter the AWS keys securely. Default: Fallback to Boto, more information here.
  • --region: AWS Region.
  • --empty-receive: [OPTIONAL][default value=10] Number of empty receives before the script gives up trying to get message from queue.*
  • --empty-receive: [OPTIONAL][default value=10] Number of empty receives before the script gives up trying to get message from queue.*
  • --max: [OPTIONAL][default value=0] Number of messages to process from the source queue. 0 means everything*
  • --max-per-request: [OPTIONAL][default value=10] Max number of messages to received from the source queue per request (this will be pass in the MaxNumberOfMessages param). Default: 10 (AWS API max limit)
  • --fifo: [OPTIONAL][default value=False] Argument that indicates that it will connect to a FIFO queue
  • --group-id: [OPTIONAL][default value=None] If you pass --fifo this will be a required argument, otherwise, it will be ignored.

* Sometimes the SQS returns false empty receives, where there is messages on queue but for some reason AWS decided not return anything on that requests. To understand more here a link from AWS docs.