This article walks you through the class of middleware technology known as message-oriented middleware.
Join the DZone community and get the full member experience.Join For Free
What Is Message-Oriented Middleware?
Message-oriented middleware is a group of software products and applications that allows applications to communicate and exchange data or messages between distributed systems. Message-oriented middleware entails data passage between applications that use a communication channel carrying self-contained elements of messages. A message-oriented middleware system offers asynchronous communication and sends data to perform asynchronous operations. This system employs inter-application software that depends on asynchronous message passage that opposes request-response architecture. The platform comprises a message queue used as a temporary stage, rendering the destination program busy or unconnected. This mechanism helps to store the message on the message-oriented middleware. Clients using message-oriented middleware can send and receive messages through this queue. The queues are the main component of implementing asynchronous interactions in message-oriented middleware.
Message-oriented middleware block representation
Structure and Working of a Message-Oriented Middleware Queue
Message-oriented middleware enhances communication between various components. Programming becomes easier through middleware in a given distributed environment. Message-oriented middleware is used as the operating system for distributed computing, and it enhances the transparency of the required applications. A message-oriented middleware acts as the postal service between different applications as it helps in information exchange.
Deployment of a MOM system
One of the primary concepts in message-oriented middleware systems is the message queue. These queues make it possible to store messages in the message-oriented middleware system. The message-oriented middleware platform can send and receive messages using queues. Queues are necessary for implementing asynchronous interaction in a message-oriented middleware platform. The messages in the queue are stored in a particular order. The messaging system uses a standard queue that is First In, First Out (FIFO). Through FIFO, the message sent first to the queue will be the first one to be retrieved from the queue. We can configure several attributes for a queue, such as a queue's name, size of the queue, queue save threshold, algorithm for sorting messages, etc. In most cases, each application has a dedicated queue, but in certain cases, the applications can share the queues because the setup is not restricted. Message-oriented middleware systems can support several queues for various reasons.
Messaging Models in Message-Oriented Middleware
Two primary messaging models commonly used in message-oriented middleware systems are published or subscribed and point-to-point models. These two models depend on message exchange through a queue. A general system will use a combination of these two models to attain different messaging aims and objectives.
Differences Between Message-Oriented Middleware and RPC
Message-oriented middleware is designed to support messages and asynchronous communication. On the other hand, remote procedure calls (RPC) support synchronous communication. The recipient server needs to be available to receive messages sent in RPC systems. If the server is down, applications will not receive the information at that time. The messages will be sent to the message-oriented middleware platform despite the receiving application being down without the need to resend. A message-oriented middleware system places messages into queues from where they are retrieved when the server requests them.
Advantages of Message-Oriented Middleware
Most message-oriented middleware implementation systems rely on the message queues, and most implementation systems use routing logic given by messaging layer. Only a few message-oriented middleware implementations rely on client applications to enhance routing information or authorize both models. Some of the implementations employ multicast or broadcast and distribution models.
Message-oriented middleware systems consist of inter-application communication software. This software depends on the asynchronous passage of messages, unlike the request-response architecture. Because of a non-synchronous system, message queues allow for temporary storage when the required program is busy or cannot get connected. In addition, most asynchronous message-oriented middleware systems offer continual storage to support message queues. The sender and receiver applications don't have to connect to the network simultaneously. This helps to solve irregular connectivity. If the recipient application fails, the sender will be able to continue unobstructed. This is because the messages will accumulate for processing in the message queue when the receiver resumes.
Message-oriented middleware systems are such that the message at the destination is not necessarily similar to the original message from the sender. A system with an inbuilt intelligence transforms messages on the way to match the needs of the receiver or sender. Together with multicast or broadcast and routing facilities, one of the applications can send a message in the native format. Two or more applications can receive a copy of this message after it has been transformed into a native format suitable for each of these two applications.
Disadvantages of Message-Oriented Middleware
One of the main disadvantages of a message-oriented middleware is that it mostly needs an additional architecture component, which is the message broker. As such, adding this extra component can reduce the system performance and make the whole system expensive and difficult to maintain.
Opinions expressed by DZone contributors are their own.