Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronous messaging  RSS feed

 
Travis Choi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to implement synchronouse messaging, but not sure if still I have to use Message Driven Bean. The main reason for the question is that I do not have anything to implement in onMessage() method in MDB.

Any input will be really appreciated!
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is not clear, if there is nothing to implement in onMessage() method how are you posting the messages to a queue or how is it processed?
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

MDB are used for receiving messages, and acting upon their content. That action might consist of replying, but I don't think MDBs are the right vehicle for synchronous messaging. What kind of messaging were you thinking of - does it have to me JMS-based, or might some other form of communication work as well (or even better)?
 
Travis Choi
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some clarifications, this is the situation how synchrounous messaging is used in my application.

The client requests action to queue in the web form, but if the response is not delivered to the client within 45 seconds, we do not need to follow up anything even when the response is available in 60 minutes.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is an idiom for synchronous messaging.

- create message
- create temporary queue
- setJMSReplyTo to use the temporary queue
- send message
- create a queue receiver for the temporary queue
- wait for a response

I've done a lot of this and it works easily in JBoss, or with a bit of head-scratching in WebLogic. I don't think it is a very strong approach. Messaging systems really gain their processing power through asychrony. I'd be careful of using this approach too much, because you give up a lot. JAAS goes out the window, and your UI won't be as responsive for tasks that execute quickly. This is a decent solution for things that are slow, but if they are that slow your UI metaphor probably shouldn't even give people the expectation of a quick response.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!