Forums Register Login

How does JMS queue works correct when it has tens of clients?

+Pie Number of slices to send: Send
Hi
Thank you for reading my post.

Imagine that we have a JMS queue and tens of thread listening on this queue, each thread has its own connection object and onMessage method.

Now my question is:
- How does JMS guarantee that each message just deliver once?
- If we use client acknoledge for session then, will queue locks until each message acknoledge or acknoledging message can be Asych ?


Thanks
+Pie Number of slices to send: Send
First of all , for queue there should be only one consumer of the message and if there is more then the JMS doesn't guarantee anything,any one of the clients might get the message or none might get.

You should use Topic's in such case.
+Pie Number of slices to send: Send
Thank you for reply
I want the message to be delivered to one and only one of them.

is it possible?

Thanks
+Pie Number of slices to send: Send
 

Originally posted by Rahul Bhattacharjee:
First of all , for queue there should be only one consumer of the message and if there is more then the JMS doesn't guarantee anything,any one of the clients might get the message or none might get.


This is a provider specific stuff.
More discussions here
What i think, using different consumers with different selectors is a valid scenario isnt it?
It comes to the point that whether i would use a different queue for broadly same but slightly different messages or i use a filter on each consumer based on the slight difference.
As mentioned in the above link, having multiple consumers also facilitate a better processing power as messages can be consumed and processed concurrently.
Ofcourse, such an application will not be portable as the behavior is undefined by the spec.
[ May 09, 2007: Message edited by: Nitesh Kant ]
+Pie Number of slices to send: Send
 

Originally posted by raminaa niilian:

I want the message to be delivered to one and only one of them.



Certainly you can , that is the only purpose of Queue.

Adding to Nitesh.As multiple consumer behaviors is not there in the JMS specification , it would not be wise for having multiple consumer for a single queue.But many vendors might implement this feature for queues also but will hit portability a lot and off course the basic reason of WORA.

You can use topics in that case.
[ May 09, 2007: Message edited by: Rahul Bhattacharjee ]
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3791 times.
Similar Threads
How to use JMS MESSAHE SELECTOR
Using JMS in distributed systems
JMS in Stateless Bean
Need Open Source email sending application
Maximum Connections in Weblogic.. please Help
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 04:20:19.