| ★ wanayoo — archive 1999 http://developer.java.sun.com/developer/technicalArticles/Networking/messaging/index.html | Nouvelle recherche | Portail wanayoo |
|
|
|
Messaging systems are used to build highly reliable, scalable, and
flexible distributed applications. This article discusses messaging systems in
general, providing an overview of their features and types, and then
describes how developers can write message-based applications
using JavaTM Messaging Service (JMS).
Distributed applications are proliferating, as are a host of previously unexplored problems of synchronization, reliability, scalability, and security. One solution is a Messaging System built from loosely coupled components communicating through messages. The Java Message Service provides a consistent API set that gives developers access to the common features of many messaging system products.
What is a Messaging System?In its essence, a messaging system allows separate, uncoupled applications to reliably communicate asynchronously. The messaging system architecture generally replaces the client/server model with a peer-to-peer relationship between individual components, where each peer can send and receive messages to and from other peers. Messaging systems provide a host of powerful advantages over other, more conventional distributed computing models. Primarily, they encourage "loose coupling" between message consumers and message producers. There is a high degree of anonymity between producer and consumer: to the message consumer, it doesn't matter who produced the message, where the producer lives on the network, or when the message was produced. This permits dynamic, reliable, and flexible systems to be built, whereby entire ensembles of sub-applications can be modified without affecting the rest of the system. Other advantages of messaging systems include high scalability (commercial implementations boast the ability to support tens of thousands of clients and tens of thousands of operations per second), easy integration into heterogeneous networks, and reliability due to lack of a single point of failure. Because of the reliable and scalable nature of messaging systems, they are used to solve many business and computing science problems. For example, they are the basis of such diverse applications as workflow, network management, communication services (voice over IP, voicemail, pager, email), customer care, weather forecasting, supply chain management, and many other systems. In addition, messaging systems are also invaluable as "glue" to bring together the disparate systems that inevitably result from mergers and acquisitions. Message System TypesTwo messaging systems models are in common use.Publish/SubscribeA publish/subscribe (pub/sub) messaging system supports an event driven model where information consumers and producers participate in the transmission of messages. Producers "publish" events, while consumers "subscribe" to events of interest, and consume the events. Producers associate messages with a specific topic, and the messaging system routes messages to consumers based on the topics the consumers register interest in. Point-To-PointIn point to point messaging systems, messages are routed to an individual consumer which maintains a queue of "incoming" messages. Messaging applications send messages to a specified queue, and clients retrieve messages from a queue. Frequently vendors will support either point-to-point, or publish/subscribe messaging models, or both. Having looked at message systems in general, we now see how Java developers can take advantage of their power. The JavaTM Message ServiceJava Message Service, part of the J2EE (Java 2 Enterprise Edition) suite, provides standard APIs that Java developers can use to access the common features of enterprise message systems. JMS supports the publish/subscribe and point-to-point models and allows the creation of message types consisting of arbitrary Java objects. Design GoalsA fundamental design goal of JMS is to provide a consistent set of interfaces that messaging system clients can use independent of the underlying message system provider. This way, not only are client applications portable across machine architectures and operating systems, they're also portable across messaging products. Client applications written to JMS will work without modification on all JMS compliant messaging systems. (This can be compared to the independence of Enterprise Java BeansTM components on the underlying middleware where the components run.) JMS was also designed to:
|