Sobes.tech
Middle

What are message brokers?

sobes.tech AI

Answer from AI

Message brokers are software components that act as intermediaries in message exchanges between different applications or services. They enable decoupled applications to interact asynchronously.

Working principles:

  1. Producers: Create messages and send them to the broker.
  2. Broker: Receives messages from producers, stores them, and forwards them to subscribers.
  3. Consumers: Receive messages from the broker when they become available.

Advantages of using:

  • Loose Coupling: Senders and subscribers do not know about each other directly.
  • Asynchronous: The sender can send a message without waiting for a response, continuing its work.
  • Reliability: The broker can guarantee message delivery even if one of the participants fails.
  • Scalability: Easily add new senders or subscribers.
  • Flow Control: The broker can regulate the rate of message consumption.

Message exchange models:

  • Point-to-Point: A message is delivered to a specific subscriber from the queue. After reading, the message is removed from the queue.
  • Publish/Subscribe: A message is sent to a topic, and can be received by multiple subscribers subscribed to that topic. A copy of the message is delivered to each subscriber.

Examples of message brokers:

  • Apache Kafka
  • RabbitMQ
  • ActiveMQ
  • Amazon SQS
  • Google Cloud Pub/Sub
What are message brokers? — Java - sobes.tech