Point to Point Messaging system

By | May 26, 2024

In a point to point messaging model, each message has one producer and one consumer. Queues are based on a point-to-point messaging model where messages are sent to queues and each message has only one producer and one consumer. In queue, messages are guaranteed to be delivered to only one consumer.

Point to Point Messaging
Queue: Point to Point messaging model

In the point-to-point messaging model, we have a producer who is responsible for producing the messages to the queue. And, the consumer listening to the queue consumes the messages; once it receives the message, it sends an acknowledgement back to the messaging server.

Characteristic of Point to Point Messaging

Following are the key characteristics of point to point messaging:

  1. Queue based
    • The queue is the place where messages are sent, and it holds the message for processing by a consumer.
  2. One to One communication
    • Each message in a queue is guaranteed to be delivered to one and only one consumer. Even if there are multiple consumers available, each message is processed by only one of them.
  3. Message persistence
    • The messages sent to the queue persist in the queue until they are successfully consumed; this ensures the reliability of the message’s delivery, even if the consumer was not active when the message was sent.
  4. Load balancing
    • If there are multiple consumers listening to the same queue, the messaging server makes sure to distribute the messages among all the consumers, effectively managing and processing the load.
  5. Acknowledgements
    • Once the message is delivered and consumed by the consumer, it sends an acknowledgement back to the messaging server, ensuring that the server can delete the message from the queue. This can be done automatically or manually using session configuration.

When to use Point to Point messaging

Point to point messaging should be used when we want our messages to be received by only one consumer. Example: order processing, where each order should be processed by only one consumer.

Leave a Reply

Your email address will not be published. Required fields are marked *