REST API that sends string message to provided SQS queue
Install swag cli:
go install github.com/swaggo/swag/cmd/swag@latest
Add swag to project dependencies:
go get github.com/swaggo/swag/cmd/swag
Generate swagger artifacts (in the root project folder):
swag init -g handlers/*.go
Locally, application needs the Localstack endpoint to produce messages. It can be provided by run_local_stack.sh file. The script will launch docker container with mocked AWS services including SQS.
AWS Credential Configurations is needed to load AWS SDK and establish connection (even with localstack). The basic instructions can be found at AWS CLI configuration Page.
To create simple Test Queue and Test Dead Letter Queue (DLQ), run create_dlq_queue.sh and create_queue.sh in that order (int the .dev folder):
./create_dlq_queue.sh
./create_queue.sh
The results look's like bellow:
{
"QueueUrl": "http://localhost:4566/000000000000/test-dlq-queue"
}
{
"QueueUrl": "http://localhost:4566/000000000000/test-queue"
}
The test-queue URL could be used
Compile and execute main process (in the root project folder):
go run ./cmd/main.go