sqs-action-dispatcher

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT

README

SQS Action Dispatcher

License CI Build Maintainability PRs Welcome

The SQS Action Dispatcher is a Go application that polls messages from an AWS Simple Queue Service (SQS) queue, processes the messages concurrently using worker goroutines, and dispatches actions based on the message content.

Features

  • Polls messages from an SQS queue in batches for improved throughput
  • Processes messages concurrently using worker goroutines
  • Moves failed messages to a Dead Letter Queue (DLQ) for further inspection
  • Dispatches actions based on message content (e.g., send an SNS notification)

Prerequisites

  • Go 1.16 or higher
  • AWS account with an SQS queue and optional DLQ configured
  • AWS CLI or environment variables with access to the SQS queue

Getting Started

  1. Clone the repository:

git clone https://github.com/your_username/sqs-action-dispatcher.git
  1. Change directory to the project:

cd sqs-action-dispatcher
  1. Build the project:

go build
  1. Set the AWS credentials and region as environment variables:

export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=your_aws_region
  1. Set environment variables for the AWS SQS queue URL and DLQ URL:

export SQS_QUEUE_URL=https://sqs.your_aws_region.amazonaws.com/your_account_id/your_queue_name
export SQS_DLQ_URL=https://sqs.your_aws_region.amazonaws.com/your_account_id/your_dlq_name
  1. Run the application:

./sqs-action-dispatcher

The application will start polling messages from the configured SQS queue, dispatch actions based on the message content, and move failed messages to the DLQ.

SNS Action

The SNS action sends a message to an SNS topic. To use the SNS action, your messages should have the following format:


{
  "type": "sns",
  "data": {
    "topic_arn": "arn:aws:sns:your_aws_region:your_account_id:your_topic_name",
    "message": "Your message to send"
  }
}

When the SQS Action Dispatcher receives a message with this format, it will send the specified message to the SNS topic.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nagstler/sqs-action-dispatcher. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Chatgpt::Ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

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