RabbitMQ — Starter Kit

  • Common Issues with Monolyth Architecture:
  1. Tightly Coupled Systems
  2. Blocking calls
  3. Communicating with applications running on a different platform and applications developed in different technologies
  4. Handling communication between applications when one of the applications is down.
  5. Building Scalable and Reliable systems
  • How the above problems can be solved by RabbitMQ — A messaging framework
  1. Decoupling Tightly Coupled Systems — This can be achieved by using the publish-subscribe feature wherein the sender application sends messages to an exchange and the receiving applications which have subscribed to the queues will receive the messages. It is similar to the sender sending an email that is received by the exchange. The exchange queues the messages to the receiver's mailbox. The receiver can open the mailbox and read the emails at his own pace. This mechanism is also called asynchronous communication.
  2. Using asynchronous communication to prevent blocking calls — Using the above mechanism blocking calls can be prevented. For example, when you order your food, other people can also order food at the same restaurant at the same time. After ordering your food you need to wait for the food to be prepared after which it is delivered.
  3. Promoting Interoperability by communicating between cross-platform systems and applications developed in different technologies. — RabbitMQ was basically built on AMQP framework to meet the messaging standards. In addition to this RabbitMQ have client libraries supporting multiple languages which makes it possible for cross-platform and applications developed in different technologies to communicate.
  1. The Producer publishes a message to an exchange. When creating an exchange, the type must be specified.
  2. The Exchange receives the message and is now responsible for routing the message. The exchange takes different message attributes into account, such as the routing key, depending on the exchange type.
  3. Bindings must be created from the exchange to queues. In this case, there are two bindings to two different queues from the exchange. The exchange routes the message into the queues depending on message attributes.
  4. The messages stay in the Queue until they are received by a consumer
  5. The Consumer receives the message from the subscribed queue.
  6. When a message is delivered to a consuming application, the consumer notifies the broker, either automatically, or as soon as the application developer chooses to do so. When message Acknowledgements are used, the message broker will only remove the message from the queue when it receives a notification for that message.
  7. If our user messages are routed by the Routing key, and a message cannot be routed anywhere, it can either be returned to the sender, dropped, or if configured, be placed on a dead letter queue which is monitored.
  • Direct: The message is routed to the queues whose binding key exactly matches the routing key of the message.
  • Fanout: A fanout exchange routes messages to all of the queues bound to it.
  • Topic: The topic exchange does a wildcard match between the routing key and the routing pattern specified in the binding.
  • Headers: Headers exchanges use the message header attributes for routing.
  1. Download and install ERlang http://erlang.org/download/otp_win64_22.3.exe
  2. Downlaod and install RabbitMQ https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.8/rabbitmq-server-3.8.8.exe
  3. Go to RabbitMQ Server install Directory C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.3\sbin
  4. Run command rabbitmq-plugins enable rabbitmq_management
  5. Open browser and enter http://localhost:15672/ to redirect to RabbitMQ Dashboard
  6. Also we can Open it with IP Address http://127.0.0.1:15672
  7. Login page default username and password is guest
  8. After successfully login you should see RabbitMQ Home page

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store