RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS

Published: 27 January 2020
on channel: Technical Babaji (Tarique Akhtar)
59,255
703

In this part of the tutorial we'll write two small programs in nodejs; a producer that sends a single message, and a consumer that receives messages and prints them out. Concentrating on this very simple thing just to get started. It's a "This is technical babaji" of messaging.

We'll call our message publisher (sender) publisher.js and our message consumer (receiver) subscriber.js. The publisher will connect to RabbitMQ, send a single message, then exit.

How to install RabbitMQ
   • How to install #RabbitMQ on windows 1...  
RABBITMQ UNDERSTANDING MESSAGE BROKER
   • RABBITMQ   UNDERSTANDING MESSAGE BROKER  

RabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that Mr. or Ms. Mailperson will eventually deliver the mail to your recipient. In this analogy, RabbitMQ is a post box, a post office and a postman.

The major difference between RabbitMQ and the post office is that it doesn't deal with paper, instead it accepts, stores and forwards binary blobs of data ‒ messages.

Producing means nothing more than sending. A program that sends messages is a producer

A queue is the name for a post box which lives inside RabbitMQ. Although messages flow through RabbitMQ and your applications, they can only be stored inside a queue. A queue is only bound by the host's memory & disk limits, it's essentially a large message buffer. Many producers can send messages that go to one queue, and many consumers can try to receive data from one queue. This is how we represent a queue

Consuming has a similar meaning to receiving. A consumer is a program that mostly waits to receive messages

Note: that the producer, consumer, and broker do not have to reside on the same host; indeed in most applications they don't. An application can be both a producer and consumer, too.


Watch video RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS online without registration, duration hours minute second in high quality. This video was added by user Technical Babaji (Tarique Akhtar) 27 January 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 59,255 once and liked it 703 people.