Messaging: Messaging is method of communication, in technological terms a communication between software components or software application.It's a P2P facility (P2P : Peer to Perr). A messaging client can create, send, receive messages to\from another client.Messaging is different from RMI (Remote Method Invocation) ,where an application needs to know about the remote application's method. In messaging sender & receiver don't have to know each other also they need not to be present together at time of communication. Sender can send message and receiver can receive it whenever it's up.
JMS specifications were first published in Aug-1998.
JMS application is composed of following parts:
1) JMS Provider : JMS provider implements JMS interfaces and provides administration & control features.It manages session and queue.
Note : From JEE 1.4 onwards JMS provider has to be contained in all application server.
Examples of few JMS provider: Weblogic, JBoss messaging & HORNETQ, Websphere MQ etc.
2) JMS Client : These are the java programs which consume or create messages for communication.
3) Messages : These are the objects that carry information while communication between JMS Clients.
4) JMS Queue : A staging area for the messages that have been send are waiting to be read.
Note : Messages don't have to be delivered in order they were sent. JMS queue only guarantees that each message will be delivered only once.
5)JMS Topic : This is a staging area for the messages which are to be delivered to multiple subscribers.
Communication Model :
There are two main communication model
- PTP (Point To Point)
- Publish\Subscribe Communication
1) PTP (Point To Point) : Point to point communication model is build around sender, queue, and receiver. In this model each message is addressed to a named queue and queue receiver consume that message.
- Each message has only one consumer.
- Receiver & sender has no timing dependencies.Receiver can fetch the message whenever it start.
- Multiple senders can be associated with one queue but only one receiver will consume the message.
2) Publish\Subscribers Communication :
In pub\sub communication model one message gets consumed by multiple subscriber .pub\sub application send & receive message by subscribing a topic. A producer sends a message to any topic and all the subscriber of that topic gets that message.Unlike PTP model , it allows multiple subscriber to receive the same message .The message retain with JMS until all the subscriber get that message.
In pub\sub communication model one message gets consumed by multiple subscriber .pub\sub application send & receive message by subscribing a topic. A producer sends a message to any topic and all the subscriber of that topic gets that message.Unlike PTP model , it allows multiple subscriber to receive the same message .The message retain with JMS until all the subscriber get that message.
- Each message have multiple consumers.
- Publisher and Subscriber have time dependency.Subscriber should subscribe topic in order to get the message.It can consume only those messages which got published after consumer's subscription, also subscriber must be active in order to consume the message.
Note : JMS API relaxes this time dependecy by providing a feature called "durable subscription" where subscription can receive the message published even when it is not active that time.
JMS Providers takes care of all the connection factory, Queue & topic creation and management with JMS specification.
No comments:
Post a Comment