Java Message Service
|
The Java Message Service API is a Java Message Oriented Middleware API for sending messages between two or more clients. The API supports two models:
- point-to-point or queuing model
- publish/subscribe model
In the point-to-point or queuing model, a producer posts messages to a particular queue and a consumer reads messages from the queue. Here, the producer knows the destination of the message and posts the message directly to the consumer's queue. It is characterized by following:
- Only one consumer will get the message
- The producer does not have to be running at the time the receiver consumes the message, nor does the receiver need to be running at the time the message is sent
- Every message successfully processed is acknowledged by the receiver
The publish/subscribe model supports publishing messages to a particular message topic. Zero or more subscribers may register interest in receiving messages on a particular message topic. In this model, neither the publisher nor the subscriber know about each other. A good metaphor for it is anonymous bulletin board. There are following characteristics for this model:
- Multiple consumers can get the message
- There is a timing dependency between publishers and subscribers. Publisher has to create a subscription in order for clients to be able to subscribe. And subscriber has to remain continuously active to receive messages.
Using Java, JMS provides a way of separating the application from the transport layer of providing data. The same Java classes can be used to communicate with different JMS Providers by accessing the JNDI information for the desired provider. The classes first use a Connection Factory to connect to the queue or topic, and then use populate and send or publish the messages. On the receiving side, the clients then receive or subscribe to the messages.
JMS Providers
In order to use JMS, one must have a JMS provider that can manage the sessions and queues. There are open source as well as proprietary providers, including:
- Websphere/MQ from IBM
- SonicMQ from Sonic Software
- BEA WebLogic Server JMS from BEA Systems
- JMS+ from webMethods - http://www.webmethods.com/
- Joram from Joram - http://joram.objectweb.org/
- SwiftMQ from SwiftMQ
- IONA JMS from IONA Technologies
- iBus from Softwired
- GigaSpaces from GigaSpaces Technologies http://www.gigaspaces.com
- ActiveMQ http://activemq.codehaus.org
- FioranoMQ from Fiorano http://www.fiorano.com/products/fmq/overview.htm
- EMS from TIBCO http://www.tibco.com/software/enterprise_backbone/enterprisemessageservice.jsp
You could find an exhaustive comparison matrix of JMS providers here: http://www.theserverside.com/reviews/matrix.tss
If you plan to run your application in a server cluster, you should check with provider if their implementation supports load balancing and/or failover..
External links
- Sun's JMS Overview (http://java.sun.com/products/jms/)
- JMS messaging articles, tutorials, and open source projects (http://www.middleware-jmsmessaging.org)
- GigaSpaces Technologies JavaSpaces approach to JMS (http://www.gigaspaces.com/product_4.html)de:Java Message Service