aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes JMS Queue ConnectionsGuys, Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Queue ConnectionsGuys," Watch "JMS Queue ConnectionsGuys," New topic
Author

JMS Queue ConnectionsGuys,

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Guys,

I have a very basic question. Let's say I have a Queue configured in a JMS server (ActiveMQ for example). I have one Producer connected to that Queue and it is sending messages to that Queue. Can I have multiple Consumers connected to that Queue. I understand that the Queue semantics is One - To - One. I'm also aware that only one Consumer would get the message. But what happens when I already have a Consumer connected to that Queue and I try to start another Consumer? Any idea as to what the JMS specifications says regarding this?


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

You can have multiple consumers. Some time ago I tested it with Message Driven Beans (MDB) on Glassfish3 server. A couple of MDBs were listening on the Queue. When I sent the message to that queue exactly one MDB received it. The receivers were picked in a random way.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Lucas Smith wrote:You can have multiple consumers. Some time ago I tested it with Message Driven Beans (MDB) on Glassfish3 server. A couple of MDBs were listening on the Queue. When I sent the message to that queue exactly one MDB received it. The receivers were picked in a random way.


Looks even more strange to me. I thought that the JMS server would allow only one connection as a consumer to a Queue. Every other clients trying to make a connection will get an exception. I guess I need to look into the JMS specification!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS Queue ConnectionsGuys,
 
Similar Threads
A basic query with respect to using Message Selectors in JMS
Can EJB's use Sockets?
asynchronous jms consumer
Multithreaded Example... Where to put WAIT() , NOTIFY() advise please
Single MDB instane - multiple messages ?