• Post Reply Bookmark Topic Watch Topic
  • New Topic

QueueRequestor  RSS feed

 
Ambika Jain
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went thru the JMS spec, but I am unable to understand the senarios in which QueueRequestor can be used. If anyone know about it, can u please share it with me.

Thanks,
 
C. Nimo
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.

a QueueRequestor is a wrapper class provided by the JMS provider. using a QueueRequestor, you simplify the following scenario:

send a message on a queue,
wait for a reply-message to arrive (that is only for you)
process that reply.

suppose, for example, that your application talks to a remote
book store. you ask that remote book store for a quote on a certain book.
Now - where would this book store put your reply for you? i mean - if you
listen to a topic - this is not secured. if you listen to a queue, you risk
missing the reply message, since others may listen to this queue as well.

what you would do is something like that:

1. create a QueueSender on the store's incoming-messages-queue
2. create a temporary queue, for the store's reply
3. create a request message asking for a quote, stating the temporary
queue in your JMSReplyTo field of the message.
4. create a QueueReceiver on the TemporaryQueue from step 2.
5. send the message using your QueueSender.send() method.
6. waiting for the reply using your QueueReceiver.receive() method.
7. process the message that the store sent you.

now, using a QueueRequestor:

1. create a QueueRequestor on the store's incoming-message-queue
2. create a request message asking for a quote.
3. use your QueueRequestor.request() method to receive the reply.
4. process the message that the store sent you.

see what i mean?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!