GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  JMS
Go To First  |  Previous Question  |  Next Question 
 JMS  |  Question 2 of 17    Print  
What is the difference between queue and topic
A connection is created between the client and the server from a connection factory. Connections can be shared by several threads. The user credentials are supplied at this level. It is probably common for a client application to share access to a single connection to the server (unless different security credentials are required for different destinations).
A session is created from a connection. The session may only be used by one thread at one time. The user credentials are inherited from the parent connection. It is probably common for each MessageProducer (TopicPublisher or QueueSender) or MessageConsumer (TopicSubscriber or QueueReceiver) to have their own session due to the threading restriction.
You can look at it like a tree. At the top you have a connection factory, beneath this you have your connections and then beneath the connections you have sessions. The leaves of the tree are the JMS actors (MessageProducers and MessageConsumers).

References: 

Creating Robust JMS Applications :  http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JMS6.html

 




  
Total Answers and Comments: 5 Last Update: February 12, 2007   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 03, 2005 16:39:50   #1  
swap        

RE: What is the difference between queue and topic
Both work on 2 different comminication models. Queue is point-to-point and topic is publish-subscriber.
 
Is this answer useful? Yes | No
July 27, 2005 14:32:58   #2  
J. P. Naidu        

RE: What is the difference between queue and topic
In queues message can be consumed by only one client where as in the topic it can consumed by n number of clients. Both are separate domain in MOM.  
 
Queue represent PTP domain and Topic represent Pub/Sub domain

 
Is this answer useful? Yes | No
September 27, 2005 10:12:51   #3  
sreenivasareddybade        

some more answer
topic is used to send more than one system at a time. where as a queue is used to send one to one system. 
 
Is this answer useful? Yes | No
October 17, 2005 02:30:07   #4  
vijayshekar        

RE: What is the difference between queue and topic

A point-to-point (PTP) product or application is built around the concept of message queues, senders, and receivers. Each message is addressed to a specific queue, and receiving clients extract messages from the queue(s) established to hold their messages. Queues retain all messages sent to them until the messages are consumed or until the messages expire.

In a publish/subscribe (pub/sub) product or application, clients address messages to a topic. Publishers and subscribers are generally anonymous and may dynamically publish or subscribe to the content hierarchy. The system takes care of distributing the messages arriving from a topic's multiple publishers to its multiple subscribers. Topics retain messages only as long as it takes to distribute them to current subscribers.


 
Is this answer useful? Yes | No
February 12, 2007 11:55:56   #5  
pradeep        

RE: What is the difference between queue and topic
Could any one of you give some sample code for JMS and MDB
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape