Businesses have spent years, even decades, developing their legacy systems. Rather than throw the baby out with the bathwater many companies continue to leverage their existing systems and continue to add functionality. Business to business communications has been the cornerstone of many IT projects. Until JMS, most, if not all, B2B data interchange used some form of EDI.
XML is a non-proprietary way to represent data. But it's just a standard of data representation. As such it lacks the ability to move over the "wire". So the question becomes how to transport XML documents. JMS is an answer. It facilitates the transport of XML documents.
JMS provides a set of interfaces for sending and receiving messages, providing a means to create loosely-coupled communication systems. JMS not only answers the XML transport question, but it does so as a Java API, thus shortening the learning curve. Previous attempts at establishing large-scale B2B communications have failed at the point which one company attempted to conform to another company's data formats. With XML the old concerns about whether your data adheres to your business partner's conventions are reduced.
JMS supports two forms of messaging: point-to-point and publish-and-subscribe. Either may be implemented as asynchronous or synchronous message transmissions. Publish-and-subscribe permits messages to be broadcast to multiple subscribers and is an excellent mechanism for many-to-many conversations. Point-to-point messaging is useful when conversations are one-to-one, and in conversations in which the receiver processes a given message just once. Receivers register their interest in those messages by subscribing to a topic or by listening to a queue. Due to the loose coupling of sender and receiver, they may have no direct knowledge of one another beyond their messaging interactions.
The ability to chose whether messages will be sent and received synchronously or asynchronously is important for the management of vital resources like database access and network bandwidth. Quality of service may be addressed by tweaking the way message queues are managed. Although the JMS specification does not require prioritized message ordering , a best effort should be made to deliver messages marked for an expedited delivery ahead of messages that are marked for normal delivery.
JMS supports two modes of message delivery. The first, "once and only once," is the most restrictive delivery mode and ensures that regardless of failure conditions a message is guaranteed to get to its intended destination. The second, "at most once" -- the least restrictive delivery mode -- allows a message to be lost due to some failure. Messages may also be specified as a transaction. A transaction message will be organized into atomic units consisting of an input message stream and an output message stream. When the transaction commits the input will be acknowledged and associated output will be sent.
An XML document may be sent by way of the text message type. The combination of a messaging service in conjunction with XML data definition is becoming the foremost choice for B2B data exchange. The significance of this exchange has given rise to additional specifications like those provided by RosettaNet, ebXML, an BizTalk which are working to provide XML with the transport mechanism it lacks.
TA Flores is an independent enteprise Java developer.
Return to ONJava.com.
Copyright © 2009 O'Reilly Media, Inc.