https://github.com/0xdebugit/nestjs-multi-queue
https://github.com/0xdebugit/nestjs-multi-queue
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/0xdebugit/nestjs-multi-queue
- Owner: 0xdebugit
- Created: 2025-03-06T11:20:50.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-06T12:09:32.000Z (11 months ago)
- Last Synced: 2025-03-06T12:31:07.275Z (11 months ago)
- Language: TypeScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Task
We would like you to create a Nest.js API that can publish and subscribe to messages on a queue. No need to worry about authorisation or authentication at this stage.
We would like the ability to swap out queue implementations based on environment variables e.g. SQS, RabbitMQ. You can look at using [Nest.js Dynamic modules](http://nest.js)
Changing queue providers should not require any code changes. Please consider [Two Factor Apps](https://12factor.net/) when designing this API.
Please include running instructions and a docker compose file to emulate and run the environment. You can use [Localstack](https://www.localstack.cloud/) to emulate AWS SQS.
Considerations:
- How can I use both queues at once?
- Handled via env
- How can I write the app to test it and have queues ready?
- E2E. We could create a separate test container and make this E2E run on test-queue, if all good we can bootstrap the main-queue
## Demo
[](https://youtu.be/W00xh2PWSB8)
## Project setup
```bash
docker-compose up --build -d
docker start
```
if incase api container fails to start, restart it
## Send Message to Queue
```bash
curl -X POST http://localhost:3000/publish -H "Content-Type: application/json" -d '{"value": "Hello from CLI"}'
```
## Receive Message from Queue
```bash
curl -X GET http://localhost:3000/consume
```
## Run tests
```bash
# e2e tests
npm run test:e2e
```