I have not done any code challenges for a long time, as I assumed they were not required for senior positions 😅.
Also, bear in mind, I never used rabbitMQ, I used to use Kafka and Google Pub/Sub, so some best practises might not be in place.
-
A boilerplate has been used to set up typescript (however, not much of TS been in the code).
-
Haven't used interfaces, so we are able to test the code properly (maybe rabbitMQ have some mock system we can employ?)
-
I didn't do any logging because I believe that microservices architectures should have a tracing mechanism enabled for debugging purposes. However, setting up OpenTracing (Jaeger or alternative) would be overkill for a code challenge.
-
I didn't process the data because it was out of the scope of the challenge.
-
Production readiness: I would have followed some best practices for a production system, such as:
- At very list I would have added a graceful shutdown.
- We should have some kind of monitoring mechanism in place
- Unit tests and maybe integration tests
- Better logger with levels if stdout logging is used in the team
- Retry-ability
- Timeouts
- Security measures
- Etc...
Here are some additional things I would have considered for a production system:
-
Scalability: The application should be able to scale horizontally to handle increasing load.
-
Resilience: The application should be able to withstand failures of individual components.
-
Fault tolerance: The application should be able to recover from failures gracefully.
- Node.js 16+
- NPM or Yarn
git clone https://github.com/Kiura/green-api.git
cd producer
yarn install
yarn start
cd ../consumer
yarn install
yarn start
curl -X POST -H "Content-Type: application/json" -d '{"clickInfo":"some info"}' localhost:4500/click