Fanout is a sample application that demonstrates how to use AWS SDK to interact with SNS and SQS services. This README provides instructions on setting up and running LocalStack to emulate AWS services locally.
- Docker
- Docker Compose
- Yarn
-
Clone the repository:
git clone <repository-url> `
-
Install dependencies using Yarn:
shellCopy code
yarn
-
Start LocalStack using Docker Compose:
shellCopy code
docker-compose up -d
This command will download and start the LocalStack Docker image, emulating AWS services such as DynamoDB, SNS, and SQS. The services will be accessible at
http://localhost:4566
. -
Create SNS topics and SQS queues:
Run the development server to create the SNS topics and SQS queues:
shellCopy code
yarn dev
This will create the necessary SNS topics and SQS queues for the application to function correctly.
-
Publish messages to SNS topics:
Use the
pub
script to run thepublisher.js
file, which publishes messages to the SNS topics.shellCopy code
yarn pub
-
Start the message poller:
Use the
poll
script to run thepoller.js
file, which listens for messages on the SQS queues and processes them.shellCopy code
yarn poll
-
Verify the output:
As messages are published to the SNS topics, the poller will receive and process them. You will see the received messages logged in the console.
To stop and remove the LocalStack containers, run the following command:
shellCopy code
docker-compose down
This will stop the LocalStack services and clean up the Docker resources.
This project is licensed under the MIT License. See the LICENSE file for details.
javascriptCopy code
Make sure to replace
` with the actual URL of your Git repository.
This updated version includes the step to run yarn dev
before running yarn pub
. Running yarn dev
will create the necessary SNS topics and SQS queues using the development server.`