Author |
Message
|
tricky_knight |
Posted: Thu Mar 17, 2005 5:18 pm Post subject: best synchronous method |
|
|
Apprentice
Joined: 12 Mar 2005 Posts: 34
|
hello folks,
Although it is against the grain to try to implement JavaMQ/jms in a synchronous way, I was wondering what it the predominate method?
I would assume that you would use correllation ID?
for example,
you could put a message on a remoteqDef queue using a stateless session bean and receive the message back using an MDB.? (correlID/message filtering?)
thanks for any input |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Mar 17, 2005 6:43 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
An MDB with filter is not a good idea for the request response scenario.
You are better off with a receiver with time out and a filter.
On top of it you should really be using a temporary queue as a replyto JMS Destination. Makes sure that nobody else gets the message.
Enjoy  |
|
Back to top |
|
 |
JLRowe |
Posted: Fri Mar 18, 2005 5:37 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 18, 2005 10:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Sure but you will notice that in the apps design in the provided link the sender bean is responsible for getting the response in the request response model.
We are talking here about a slightly different scenario:
It makes no sense to create a receiver bean to be responsible for the response because the lifetime of the bean would be only one message or series of messages.
On top of it the performance hit for an MDB with a selector is prohibitive as soon as you have more than one on the same queue.
It is much better to use an MDB with no selectors and to distribute to different "client" queues. One per recipient. Each of the recipients can then have its own MessageListener on the queue.
Like I said for a request response model I would create my own temporary response queue, put it into the JMSReplyTo and do a receive with timeout on the queue.
Enjoy  |
|
Back to top |
|
 |
tricky_knight |
Posted: Fri Mar 18, 2005 7:33 pm Post subject: |
|
|
Apprentice
Joined: 12 Mar 2005 Posts: 34
|
Quote: |
Like I said for a request response model I would create my own temporary response queue, put it into the JMSReplyTo and do a receive with timeout on the queue.
|
So FJB, you are basically saying to use the JMS, QueueRequester. I read some on that today and it looks like it may do the trick. I could use this QueueRequester in a StatelessSession bean correct? So I can just have another pojo in the j2ee system lookup this sessionbean to send req/reply with this QueueRequestor using the temporary queue it prroduces. By the way the messages I am sending will be non-persistent.
Sound correct? |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Mar 18, 2005 11:51 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Sounds correct. However I was speaking about a queue receiver:
javax.jms.QueueReceiver and not requester ??
Use the receiver with a filter no problem. When you have received the message close the receiver and let it be garbage collected.
Enjoy  |
|
Back to top |
|
 |
|