Rabbit MQ

Rabbit MQ

Rabbit MQ is the most popular open-source and cross-platform message broker (messages queue software) that accepts, stores and forward messages. It implements Advanced Messaging Queuing Protocol ( AMQP).

Decoupling of software components is one of the major parts of software design. One way to achieve decoupling is building messaging applications which can be achieved by “RabbitMQ”, way to exchange data between different applications.

Why and when to use?

Most organizations nowadays perform multiple tasks in single application like sending mail, SMS that can create a heavy load on the application, so if we separate the tasks, will get more space/memory to serve more requests. By using RabbitMQ we can reduce the load on the application.

Let’s take a quick look at how messaging works.

We have two kinds of applications interacting with the messaging system :

>> Sender:

The person/program that send messages to the broker.

>> Consumer :

Program that receives messages from the broker.

Usually, these are the two different applications running on different machines and RabbitMQ works as a middleware between the two applications.

 

Sender                                       Queue                              Consumer

Using RabbitMQ with Visual Studio :

1. Installation : 

Before we start, we need to install Erlang and RabbitMQ in the system. After RabbitMQ is been installed in the system we need RabbitMQ.net Client service to connect with RabbitMQ service. We can install RabbitMQ client via Nuget Package Manager in Visual studio.     

2. Build .net application using RabbitMQ:

Create a Windows Application in visual studio. Install RabbitMQ client using Nuget package Manager.

Now let’s start with the messaging windows application :

>> Form

 

>> After designing the form, click on submit button and write the following code to send the message using Rabbit MQ client over the queue.

Hostname: It will be the IP Address on which the RabbitMQ service is running, by default it takes localhost.

>>  It will send the message to RabbitMQ client (Sender) :

 

>> As soon as we send the message, it will be visible into RabbitMQ queue.

The above image shows our message is been queued up.

We can find the message is sent by the sender.

This message is not yet received by Receiver as we need to manage receiver end.

Prateek Saxena
Ajay Kumar Goel
CEO/Director
  • ✔ 10+ years of professional experience which includes 5+ years as Founder and Co-Founder as a Technology Partner of lean startups across different domains.
  • ✔ Technology Advisor to various companies and organizations.
  • ✔ Passionate for technology & businesses and making them successful.
  • ✔ Core competencies in Project Management methodologies and implementing digital strategies using Web 2.0 Technologies.