Skip to content

devworlds/event-driven-example

Repository files navigation

Event Driven Architecture

This project is an example of event-driven architecture using SQS/SNS and RabbitMQ.

Table of Contents

Installation

To install the project dependencies, run:

npm install

Configuration

Configure LocalStack using Docker

To configure LocalStack using a Docker image, follow the steps below:

Windows
  • Download LocalStack Desktop on microsoft store
  • Create account to free user
  • Launch a new LocalStack Container inside LocalStack Desktop
  • Access container created, and create SQS and SNS services
  • Configure SNS subscription to your SQS
  • Done
Linux
    #Todo

Configure RabbitMQ using Docker

    docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management

The exchange and queues are created on code, only need to have a local rabbitMQ running.

Configure the .env file

#publisher and receiver type
RECEIVER_TYPE=rabbitmq
PUBLISHER_TYPE=rabbitmq

#rabbitmq config
RABBITMQ_URL=amqp://localhost
QUEUE_NAME=order-queue
EXCHANGE_NAME=orders
ROUTING_KEY=""

#aws config
ACCESS_KEY_ID=""
SECRET_ACCESS_KEY=""
SESSION_TOKEN=""
REGION="us-east-1"

#sns config
TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:ORDERS-CREATED"

#sqs config
QUEUE_URL="http://localhost.localstack.cloud:4566/000000000000/orders-process"

Usage

To start the application, run:

npm run start

Available Scripts

  • Generate Documentation:
npm run docs
  • Start the Application:
npm run start

Technologies Used

  • Node.js
  • Express
  • TypeScript
  • AWS SDK
  • RabbitMQ
  • Docker
  • Pino (for logging)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published