The problem JMS solves:
- Enterprise applications grow at their own will. But, when the point of integration comes, nightmare begins.
- MOM (see below) allows passing messages (containing information, transaction, etc.) between applications in asynchronous manner.
Characteristics of JMS:
- Vendor-agnostic Java API for MOM (much like JDBC allows seamless connectivity to different databases)
- Message indicates a piece of information, transaction etc.
- In MOM, there are topics or queues where people share messages. (There is a different between topic and queue; explanation coming.)
- There are applications called clients who work with specific topics or queues.Those to produce messages are called producers. Those to receives messages are called subscribers. A client can be both producer and consumer at the same time for a topic/queue.
- For a specific topic/queue, there can be more that one producers, and consumers.
- When a producer, subscribing to a particular topic/queue, sends a message to JMS,JMS pushes the message to consumer subscribing to that topic/queue. This way the producer and consumer are working asynchronously.
- JMS Provider (JMS server) can make messages persistent, meaning it ensure that messages are not lost till they are consumed. (Store-and-Forward vs Fire-and-Forget)
- Topic vs Queue: Topics can have more that one consumer, and each message is sent to all of the consumers. Queues can have more than one consumer, and the contract fulfills when exactly one consumer consumes the message.
- Usually a subscriber doesn't receive a message if it is not present (i.e. connected) when a message is produced. A subscriber can request to be a durable subscriber (on a topic). If that consumer is not connected when a message is produced, JMS provider will make sure that i sends when that subscriber connects.
Durability modifies the behavior of subscriber. - From the producer side, it can request a particular message to be persistent. When the call from JMS provider returns, it guarantees that the message has be stored on a reliable media (file, or DB, or something else).
The buzz words:
- MOM - Message Oriented Middleware (a.k.a. Enterprise Messaging System)
Links:
- Book "Java Messaging Service" by Richard Monson-Haefel & David A. Chappell, from Oreilly - borrowed the book from my colleague Kevin
No comments:
Post a Comment