O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

RabbitMQ

One of the most widely deployed message brokers, RabbitMQ operates on AMQP protocol. The amqplib client for Node.js is widely adopted and has more than 16,000 downloads per day. In this section, we will look at a sample implementation of amqp and understand the options given by it. RabbitMQ follows more of an event based approach where each service listens to RabbitMQ "tasks" queue and on listening for an event, the service completes its task and then sends it to a completed_tasks queue. API Gateway listens for the completed_tasks queue and when it receives a message, it sends the response back to the client. So let us design our RabbitMQ class by performing the following steps:

  1. We will define our constructor as follows:
constructor(host, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required