The previous article in this series discussed the differences between synchronous systems and asynchronous systems. One of the prerequisites of an asynchronous system is an infrastructure for reliably delivering messages from the sender to the recipient. This functionality is usually provided by messaging-oriented middleware (MOM). Following are some popular examples of MOM packages:
WebSphere MQ from IBM owns the lion's share of the market and is available on more than 35 platforms.
SonicMQ from Sonic Software is popular among the J2EE market.
MSMQ from Microsoft is popular among the Microsoft market, obviously.
Different MOM packages offer different functionality, but at minimum they need to provide the following services:
Guaranteed delivery specifies that a message, once sent, is guaranteed to arrive at the recipient. If the recipient is unavailable, the messaging system needs to queue this message and continue retrying. The MOM provides a store-forward mechanism to store the message in persistent storage (either a filesystem or a database) and then forward the message at the appropriate time. Most MOM packages can be configured so that after a certain number of tries or an amount of elapsed time, the MOM can conclude that the remote system is unreachable and log an error. This is similar to most email systems, which try to deliver a message up to a certain number of attempts or amount of elapsed time. At some point, if the recipient is unreachable (perhaps because of an erroneous email address or invalid domain), the email system simply sends an error message back to the sender.
"Only once" delivery is an often overlooked feature, but it's critical because duplicate messages can result in additional network trafficand in some cases erroneous results. Consider the situation where the sender sends a message to deduct $500 from a bank account. The messaging system needs to ensure that only one such message is sent to the recipient; otherwise, the result can be an irate bank customer.
In-order delivery requires that outbound messages be received in the order in which they were sent. A robust MOM must ensure in-order delivery because the order can affect the state of the recipient if the messages are individual steps of a transaction. In a series of bank transactions, for example, suppose that the balance is originally $1,000. A sequence of messages contains a deposit of $2,000 and then a transfer of $2,500. If the transfer message is somehow received first, this would result in an insufficient funds problem for our (now very irate) customer.
Different features were added as these packages have evolved, creating a new category: integration brokers. Usually built on MOM packages, integration brokers provide the following additional features:
- Content-based routing (also called intelligent routing)
- Workflow modeling
- Message warehousing
While it not may be immediately obvious, these integration brokers are still necessary even if web services are used. Broadly speaking, web services only define how two or more systems should communicate; they don't provide the services listed above, which are critical to a robust enterprise system. Thus, for the foreseeable future, web services have to coexist with integration brokers, and it's worthwhile to understand the capabilities of these technologies. (A future article will discuss an emerging set of vendors who are addressing these shortcomings in web services; that category is called web service networks.)