A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
One of the principles of message-oriented middleware and introduction to JMS
Nowadays, more and more enterprises are facing various types of data integration and system integration. RPC middleware technologies such as CORBA, DCOM, and RMI have also emerged. However, due to the use of RPC synchronous processing technology, there are many shortcomings in performance, robustness, and scalability. The message-based Asynchronous processing model adopts the non-blocking calling feature. The sender sends the message to the Message Server and the Message Server forwards the message to the receiver when appropriate; sending and receiving are asynchronous, and the sender does not have to wait. The lifecycles of the two can also be different, and the sender can indirectly send messages to multiple recipients, this greatly improves program performance, scalability, and robustness, making asynchronous processing models more attractive in distributed applications than synchronous processing models. 
This article first introduces the principles of message-oriented middleware, and then introduces popular message-oriented middleware Products and some open-source implementations. At last, we analyzed in detail the specifications (JMS) proposed by Sun and its partners to unify the interfaces of various message-oriented middleware systems ).
Keywords: Message Middleware, JMS, point-to-point, publish/SubscribeI. Introduction to middleware 1.1 Definition of Middleware
Middleware (middleware) is a type of basic software and belongs to reusable software. Middleware is based on the operating system software, network and database, and under the application software, the general role is to provide the development environment for the application software at its upper layer, it helps users develop and integrate complex application software flexibly and efficiently. 
IDC defines middleware as an independent system software or service program. Distributed Application Software shares resources between different technologies with this software, middleware is positioned on the operating system of the client server to manage computer resources and network communication.
Middleware is a type of software based on distributed processing. The most prominent feature of middleware is its network communication function. Middleware can also be considered as a common service between the platform and the application. These services have standard program interfaces and protocols. For different operating systems and hardware platforms, multiple implementations can comply with interfaces and protocols. 
Figure 1.1 Middleware
1.2 classification of Middleware
According to the IDC classification method, the middleware can be divided into six categories: 
1) terminal simulation/screen Conversion
2) data access middleware (UDA)
3) Remote Procedure Call middleware (RPC)
4) Message Middleware (MOM)
5) transaction middleware (TPM)
6) object middleware
However, in practical applications, middleware is generally divided into two categories: one is the underlying middleware, which is used to support a single application system or solve a type of problem, it includes transaction middleware, application server, message middleware, and data access middleware. The other is high-level middleware, which is more used for system integration, enterprise Application Integration Middleware, workflow middleware, and portal middleware are usually used to deal with multiple application systems. They have a high level in the system and are mostly run based on the underlying middleware of the previous category.1.2.1 terminal simulation/screen Conversion
This type of middleware is used to achieve interoperability between client graphical user interfaces and existing character interface server applications. Applications and earlier mainframe systems are rarely used.1.2.2 data access middleware
This type of middleware is used to establish a mode for data application resource interoperability and connect databases or file systems in heterogeneous environments.1.2.3 Remote Process calling Middleware
This type of middleware allows developers to call the process on a remote server as needed, blocking communication details during the call process. An application uses RPC to remotely execute a process in a different address space. In terms of effect, it is the same as executing a local call.1.2.4 transaction middleware
This middleware is specially designed for online transaction systems. Online transaction systems need to process a large number of concurrent processes. Processing concurrency involves operating systems, file systems, programming languages, data communication, database systems, system management, and application software. Transaction middleware implements resource management, transaction management, and Application Based on Distributed Transaction processing standards and reference models, making it easier to develop applications based on transaction middleware. Transaction middleware is only applicable to online transaction systems and is a dedicated middleware.1.2.5 message-oriented Middleware
This type of middleware refers to the use of an efficient and reliable message transmission mechanism for platform-independent data exchange and integration of Distributed Systems Based on Data Communication. By providing message transmission and Message Queuing Models, it can expand inter-process communication in a distributed environment.
Message-oriented middleware supports synchronous mode and asynchronous mode. Asynchronous middleware is more fault tolerant than synchronous middleware, and ensures normal message transmission in case of system failure. Asynchronous middleware technology is divided into two types: broadcast mode and publish/subscribe mode. Since the publishing/subscription method can specify which type of messages can be accepted by users, it is more targeted and has become an informal standard for asynchronous middleware. Currently, mainstream message-oriented middleware Products include IBM MQSeries, Bea messageq and Sun's JMS .1.2.6 object middleware
Traditional object technology provides good code reuse functions through encapsulation, inheritance, and polymorphism. However, these objects only exist in the same program. They are not known to the outside world and cannot be accessed. Object-oriented middleware provides a standard construction framework that enables software from different manufacturers to achieve interactive access through different address spaces, networks, and operating systems. The goal of object-oriented middleware is to provide an application-level plug-and-play interoperability for software users and developers. Currently, the mainstream object middleware is OMG's CORBA, Microsoft's com, IBM's som, and Sun's RMI.
1.3 features of Middleware
Generally speaking, middleware has the following features: it meets the needs of a large number of applications, runs on a variety of hardware and operating system platforms, supports distributed computing, and supports standard interfaces and protocols. By calling a large number of Apis provided by middleware, developers can communicate in heterogeneous environments, thus shielding complex operating systems and network protocols in heterogeneous systems.
Due to the importance of standard interfaces for portability and standard protocols for interoperability, middleware has become a major part of many standardization work. Distributed Application Software can share resources between different technologies with middleware.
In general, middleware shields the complexity of the underlying operating system and enables program developers to face a simple and unified development environment, reducing the complexity of program design, focus on your own business, without having to repeat the porting of programs on different software systems, thus greatly reducing the technical burden.
Ii. Principles of message-oriented Middleware
Message-oriented middleware (MOM) provides a flexible and loosely coupled mechanism for integrating applications. They provide asynchronous data transmission between storage and forwarding-based applications, that is, applications do not directly communicate with each other, but communicate with the mom as an intermediary. MOM provides guaranteed message sending (at least to do this as much as possible). Application developers do not need to understand the details of Remote Process calling (PRC) and network/communication protocols.2.1 Introduction to message-oriented Middleware
Message-oriented middleware uses an efficient and reliable message transmission mechanism for platform-independent data exchange and integrates distributed systems based on data communication. By providing message transmission and Message Queuing Models, it can expand inter-process communication in a distributed environment.
Message-oriented middleware is suitable for distributed environments that require reliable data transmission. In a system that uses the message-oriented middleware mechanism, different objects use messages to activate events of the other party and complete corresponding operations. The sender sends the message to the Message Server. The message server stores the message in several queues and forwards the message to the receiver when appropriate. Message-oriented middleware can communicate between different platforms. It is often used to shield the features of various platforms and protocols, so as to realize the collaboration between applications, its advantage is that it can provide synchronous and asynchronous connections between the customer and the server, and can transmit or store and forward messages at any time, this is also the reason why it is more advanced than remote process calls.
As shown in, application a and application B send messages by using the mom Application Programming Interface (API.
Mom routes messages to application B so that messages can be stored on different computers, and mom processes network communication. If the network connection is unavailable, Mom stores the message until the connection becomes available and forwards the message to application B.
Another aspect of flexibility is that when application a sends its message, application B may not even be in the execution state. Mom will keep the message until application B starts to execute and tries to retrieve the message. This also prevents application a from blocking because it waits for application B to retrieve messages. This asynchronous communication requires that the application be designed differently from most of today's applications. However, it may be an extremely useful method for time-independent or parallel processing.
Distributed Object calls, such as CORBA, RMI, and DCOM, provide a communication mechanism that transparently transmits Object Requests in Heterogeneous Distributed computing environments, these objects can be located on local or remote machines. It provides a unified interface between objects, so that calls and data sharing between objects do not care about the object location, implementation language, and the operating system where the object resides. This interface is an object-oriented middleware.
Although object-oriented middleware is widely used as a powerful specification, these technologies also show limitations in the face of Large-Scale Complex Distributed Systems:
1. synchronous communication: After the customer sends a call, it must wait until the service object completes processing and returns the result before continuing to execute.
2. the lifecycle of the customer and the service object is closely coupled: both the customer process and the service object process must run normally. If the customer's request is not reachable due to the service object crash or network failure, the customer receives an exception.
To solve these problems, message-oriented middleware emerged, which better solved the above problems.
As an intermediate layer software, message-oriented middleware provides a reliable and common method for creating, sending, and receiving messages in distributed systems, provides reliable, efficient, and real-time cross-platform data transmission in distributed systems. Message-oriented middleware reduces the complexity of developing cross-platform and network protocol software. It shields the details of different operating systems and network protocols and faces distributed systems with increasing scale and complexity, message-oriented middleware technology shows its advantages:
1. asynchronous Communication Mode: the sender can perform other work after sending the message, without waiting for the response from the receiver, and the receiver does not have to process the request from the sender immediately after receiving the message;
2. loose coupling between the customer and the service object lifecycle: the customer process and the service object process do not require normal operation. If the customer's request is not reachable due to the service object crash or network failure, the customer will not receive any exceptions, and the message middleware can ensure that the messages will not be lost.
Start building with 50+ products and up to 12 months usage for Elastic Compute Service