• Post Reply Bookmark Topic Watch Topic
  • New Topic

help please-- what to implement Queue or Topic ?

 
deepa karkala
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have got basic concepts of JMS by going through the sun tutorial. I would highly appreciate if anyone who is expert in JMS can guide me in implementing my project requirement.

I have a requirement in my project for which I feel I can use JMS rather than conventioanl distributed mode. In my application, I will be creating n number of tenders and sending them to various truck carriers. Some tenders are specific to a set of carriers and some tenders are public tenders which have to be sent to all carriers.
For example : tender 1, tender 2, tender 3 have to be sent only to carrier1
tender 4 has to be sent only to carrier 2
tender 5 has to be sent only to carrier 3
tender 6 to tender 10 are public tenders and have to be sent to all the 3 carriers.
My approach ( please correct me if I am wrong
Public tenders can be published to a topic and i can subscribe all the carriers to this topic to get public tenders.
what about tenders 1 to 5 ?
Should I create queue 1 for sending tender 1 to 3 and make carrier 1 to receive the tenders only from queue1
create queue 2 for sending tender 4 and make carrier 2 to receive the tenders only from queue2
create queue 3 for sending tender 5 and make carrier 3 to receive the tenders only from queue3
create a topic to send tenders 6 to 10 and subscribe all the carriers 1,2,3 so that all of them will get these public tenders.

Please guide me if I am wrong in this approach. If i am correct, does it mean that i have to maintain n number of queues if there are n carriers so that each of them is going to receive some specific tenders at any point of time by dedicated queues for them?
thanks in advance.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you need to send messages to only one subscriber, you can use a single shared topic and message selectors. Each carrier subscribes to the shared topic by declaring a message selector for "carrier-x", "carrier-y", etc. Now, when you publish the tender to this topic, you specify which carrier it is for by using message properties.
 
deepa karkala
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Lasse for your quick reply. Your answer looks very interesting. Let me explore more on it.
thank you once again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!