RabbitMQ with Node.js POC
Basic RabbitMQ integration with Node.js using amqplib.
Required Dependencies
- Docker
- Docker Compose
Usage
- Clone this project and install its dependencies with yarn or npm:
yarn
-- or --
npm install
- Start the local RabbitMQ instance with Docker Compose in the root folder where the
docker-compose.yml
file is located:
sudo docker-compose up
-
Open http://localhost:15672 on your browser, then you should see the RabbitMQ UI
-
Type
guest
for both the username and password -
Now open a terminal window and start the
consumer
script, located in thesrc
directory, that will listen to the messages in the RabbitMQ Queue:
node consumer.js
- Finally, start the
producer
script on another terminal window that will send the messages to the queue:
node producer.js
- You should be able to see the received messages on the
consumer
terminal window and also the incoming activity on the RabbitMQ admin panel running on the browser.