Header
Home | Sitemap  
Sections
Archive
Su Mo Tu We Th Fr Sa
1
2345678
9101112131415
16171819202122
23242526272829
30
Syndication



The JMS API

by

image

 

The JMS API

The JMS API allows applications to create, send, receive, and read messages. Messages can arrive asynchronously, meaning the client does not have to specifically request messages in order to receive them. In addition, the programmer can specify different levels of reliability, depending on the type of message transmitted. Unlike traditional low-level network remote procedure call mechanisms, JMS is loosely coupled, meaning that the sending and receiving applications do not both have to be available at the same time to enable communication (Sun Microsystems, 2002). In other words, the sender and receiver need not know anything about each other when communicating. This is particularly useful in the wireless domain because of the "sometimes on" characteristics of wireless devices.

The JMS API Architecture

The following components are present in a JMS implementation:

The JMS Programming Model

The JMS programming model can be summarized in Figure 4.

Click To expand
Figure 4: The JMS Programming Model

JMS Reliability Mechanisms

JMS tackles several of the issues inherent in message-oriented middleware in the wireless domain. These include the following:

  • Message persistence. What happens if the JMS provider fails or is unavailable during message transfer?

  • Message expiration. How does one ensure that unconsumed messages do not cause performance degradation on the system, for example, by filling a particular queue to capacity?

  • Durability. Especially in the publish/subscribe domain, what happens to messages published while a subscriber is inactive?

Message Persistence

JMS provides two delivery modes for messages. The NON_PERSISTENT mode ensures the lowest overhead but means that messages are not logged to stable storage and are, consequently, lost when a connection to a JMS provider goes down (JMS Specification, 2002). The PERSISTENT mode, on the other hand, is vital for lossy wireless links, where stable connections are unlikely. Messages delivered using the PERSISTENT mode are stored, so that if the link goes down, the JMS provider can reattempt the delivery later. The decision to choose PERSISTENT or NONPERSISTENT delivery is essentially a tradeoff between performance and reliability. Clearly, the PERSISTENT mode causes performance degradation due to the overhead involved in storing messages, but it guarantees delivery of messages. The reverse is true for the NONPERSISTENT mode (JMS Specification, 2002).

Message Expiration

Each JMS message has an expiration field in its header. A time-to-live value in milliseconds can be specified in this field. The message expiration time is equal to the sum of the current GMT and the time-to-live value. Messages that are not delivered before the expiration time are deleted in order to conserve storage and computing resources (Sun Microsystems, 2002).

Durability

The createDurableSubscriber method of the TopicSession class allows a client to have messages retained by the JMS provider while the client is inactive. The JMS provider stores the messages published to a topic in a persistent queue. When the client reactivates, it is able to retrieve messages published while it was inactive (Sun Microsystems, 2002).

Other Reliability Mechanisms

For a message to be considered as having been consumed successfully, it has to be acknowledged by the receiving party. However, for performance reasons, it may be inconvenient to acknowledge every message that is received. JMS provides different levels of acknowledgment. When the AUTO_ACKNOWLEDGE value of a particular session is set, all messages belonging to the session are acknowledged. The CLIENT_ACKNOWLEDGE value specifies that messages will be acknowledged on the session level. This means that acknowledging receipt of a message during a session automatically acknowledges receipt of all other messages during that session. The DUPS_OK_ACKNOWLEDGE value allows lazy acknowledgment of messages and is likely to result in duplicate messages being delivered. This value should be set when the client wishes to reduce session overhead but can tolerate duplicate messages arriving (Sun Microsystems, 2002).

Message priorities can be set in order to instruct the JMS provider to deliver urgent messages first. Message priorities are specified on a scale from 0 (lowest) to 9 (highest).

JMS sessions can be transactional. The first argument to the createSession method specifies whether the session is transacted or not. With transacted sessions, if one operation fails, all changes made during that session are rolled back to a previous committed state. Thus, the operations in the session are seen as an autonomic unit of work (Sun Microsystems, 2002).

182 times read

Related news

» The JMS API
by admin posted on Apr 23,2007
» Bandwidth
by admin posted on Aug 08,2007
» Push versus Pull Notifications
by admin posted on Jul 19,2007
» ICMP Message Format
by admin posted on Dec 09,2006
» JMS in Commercial Wireless Middleware Products
by admin posted on Jul 25,2007


More Top News
Cisco Wireless Networking
Most Popular
Featured Author