Basic concept of Messaging

Sidath Weerasinghe
4 min readApr 14, 2018

Messaging is a technique that enables high-speed, asynchronous, program to program communication with reliable transmission. In the computer programs communicate by sending the data packets to define destinations, are called messages. Logical pathways that connect the programs and convey messages are called Channel. A program that sends a message by writing the message to a channel is called ender or message producer. A receiver or consumer is a program that receives a message by reading it from a channel. The message contains two main parts named as header and the message body. The header contains the metadata of the message such as sender details, destination details and etc. The message body contains the application data which is used by the destination point program. Messaging abilities are typically given by a separate software system called a messaging system or message-oriented middleware (MOM). The messaging system correlates and manages the sending and receiving of messages. For passing the message sender and the receiver should need to be ready and the reliable transport medium should be there for both parties.

Message Transmit Steps

  • Create — The sender creates the message with application data.
  • Send — The sender adds the message to a channel.
  • Deliver — The messaging system moves the message from the sender to the receiver, making it available to the receiver.
  • Receive — The receiver reads the message from the channel.
  • Process — The receiver gets the data from the message.

There are have 2 importance messaging concept by considering message receiving.

  1. Send and forget — Sender put the message to the channel and not wait for the receive the acknowledgement. In this scenario, sender thinks the message is successfully received by the receiver. No resending happens.
  2. Store and forward — In this method sender put the message to the channel and then store the message on the sender’s device memory or disk. If the acknowledgement happens then the stored message get discard. Otherwise forward the message again while it receives to the destination.

Advantages of Messaging

Remote Communication — Able to communicate the two or more separate application via message passing.

Platform and Language Integration — Different platforms(applications) written in the different languages. So the when we integration via a traditional method then it is very different to communicate with those systems because of the implementation is different. Messaging does their integration without any interference. Messaging layer does not depend on the platform and its implementation.

Asynchronous Communication — Messaging enables a send-and-forget approach to communication. The sender does not have to wait for the receiver to receive and process the message.

Throttling — One of the problems is the receiver received a lot of messages at the same time. Because of that, the receiver performance can be degraded and the sometimes receiver can crash. As a solution for that messages can be stored in a queue until processor can throttle out the messages from the receiver. The system is unaffected by this throttling because of the communication is asynchronous.

Reliable Communication — Messaging provides the reliable delivery of the message by using the ‘store and forward’ concept. Using this concept message guarantee the delivery. Use the automatic retry
feature in the messaging system to overcome problems with the network so that the sender and receiver don’t have to worry about that.

Mediation — Messaging allowed the mediation. The messaging mediator can enable the redundant
resources to provide high availability, apply some logic to the message, balance load, reroute around
failed network connections, can edit the message, tune performance and quality of service.

Disconnected Operation — Messaging enables the synchronized data. This is more important because we can not trust the network. If the one device disconnect and after the reconnect the device then the synchronized happen. So that the message lost never happens.
This is like the durable subscription.

Challenges of Messaging

Complex programming model — Messaging system can be categorized as event-driven programs. It is not just a calling method, it needs to handle every event by managing threads and disruptors. Such a system is more complex and harder to develop and debug.

Sequence issues — Message channels guarantee message delivery but the message sequence is not guaranteed. In the real world, message sequence is very important.

Vendor lock-in — Lot of messaging protocol does not allow the custom implementations of the protocol. So that the protocol conversion is the big challenge.

Limited platform support — every platform not contains the messaging system.

Performance — Messaging adds some additional overhead to the communication.

References

Enterprise Integration Patterns Designing, Building, and Deploying Messaging Solutions by Gregor Hohpe and Bobby Woolf

--

--