sqsproxyd is SQS proxy daemon.
This is an application that imitates SQS daemon (sqsd) provided in the AWS Elastic Beanstalk worker environment. In addition, it has the ability to send a response (= forward) to another SQS.
- Receive (dequeue) a message from SQS and make a POST request to the specified API.
- If the API returns a success response (HTTP status: 2**), removes the message from the SQS.
- [Optional] If an output SQS is set, the API success response body be sent (enqueued) to that SQS as a message.
The purpose is to make it easy to build a microservice architecture system using SQS. By completely hiding the SQS input and output in sqsproxyd (and its configuration), application developers can focus on implementing the API.
The binaries can be downloaded here.
$ sqsproxyd \
--sqs-url https://sqs.us-west-1.amazonaws.com/123456789012/sqsproxyd-sqs \
--api-url http://localhost:4000/api The sqsproxyd container image can also be pulled from Docker Hub.
$ docker pull ohke/sqsproxyd
$ docker run ohke/sqsproxyd \
--sqs-url https://sqs.us-west-1.amazonaws.com/123456789012/sqsproxyd-sqs \
--api-url http://localhost:4000/apiPlease, see examples.
Either method can be used to pass parameters. If a value exists for both, command-line arguments take precedence.
- Environment variables
- Command-line arguments
| Command-line argument | Environment variable | Required | Default | Description |
|---|---|---|---|---|
| --aws-access-key-id | AWS_ACCESS_KEY_ID | no | - | Your AWS access key ID |
| --aws-secret-access-key | AWS_SECRET_ACCESS_KEY | no | - | Your AWS secret access key |
| --aws-session-token | AWS_SESSION_TOKEN | no | - | Your AWS session token |
| --aws-region | SQSPROXYD_AWS_REGION or AWS_DEFAULT_REGION | no | - | Your AWS region name |
| --aws-endpoint | SQSPROXYD_AWS_ENDPOINT | no | - | To use mock SQS (like alpine-sqs) |
| --sqs-url | SQSPROXYD_SQS_URL | yes | - | SQS URL to input |
| --api-url | SQSPROXYD_API_URL | yes | - | API URL to POST request |
| --output-sqs-url | SQSPROXYD_OUTPUT_SQS_URL | no | - | SQS URL to forward response message |
| --num-workers | SQSPROXYD_NUM_WORKERS | no | 1 | Number of concurrent workers |
| --api-timeout-msec | SQSPROXYD_API_TIMEOUT_MSEC | no | 30000 | API connection timeout milliseconds |
| --sleep-msec | SQSPROXYD_SLEEP_MSEC | no | 1000 | Interval milliseconds of receiving when retrieving 0 message |
| --api-health-url | SQSPROXYD_API_HEALTH_URL | no | - | API health check URL to GET request |
| --api-health-interval-seconds | SQSPROXYD_API_HEALTH_INTERVAL_SECONDS | no | 1 | Interval seconds of request health check endpoint |
| --content-type | SQSPROXYD_CONTENT_TYPE | no | application/json |
Content-type header of API request |
| --rust-log | SQSPROXYD_RUST_LOG | no | WARN |
Application logging directive |
Install followings.
$ git clone https://github.com/ohke/sqsproxyd.git
$ cd sqsproxyd
$ cargo build$ cp ./env/local.env ./.env
$ direnv allow
$ docker-compose up -d sqsproxyd-sqs sqsproxyd-api
$ cargo runsqsproxyd is available under the Apache-2.0 open source license.