Friday, June 25, 2010

JAVA Message Service: Understanding the concept of message queues

There is a JMS Application, running over the network. There is one Message producer and three message consumers (All different machines). All clients (producers and consumers) have a common Connection Factory and are registered to the same queue. 
I want to understand the running process more clearly. 

1. Does each consumer maintain its own queue ? or Do All share the producer's queue?
2. Does the consumers take the next message only when it has read the current message?
3. Or is it the contrary, The consumers take messages in their queue and then read the messages one by one.
4. Do the consumers PULL messages from the producer or does the producer PUSH messages on to the consumers.

I basically want to know the complete frame work.

Ans : 
 Hi!

1) All share the producer's queue. 
2) The queue is FIFO so you can't read the next message until after reading the current. 
3) No, if they (the clients) are registered to the same queue then they have to access the queue (on the server) 
4) It's a PULL method that is applied. That is the consumer has to acknowledge that it has read the message. 

Here are some JMS examples
http://www.java2s.com/Code/Java/J2EE/Java-Message-Service-JMS.htm

Here are some tutorials/articles on JMS
http://java.sun.com/products/jms/tutorial/index.html
http://www.roseindia.net/software-tutorials/detail/5784

Hope this helps. 

Ans 1 : 

No comments:

Blog Archive