- Posted by: Vincent Shek
- Posted on: February 23 2003 21:26 EST
What's the best way to achieve synchronous behaviour to a system that only process requests asynchronously?
The asynchronous system is comprised of JMS Queues and MDBs. Requests are made by sending an appropriate message to the one of the designated queues. The client application is another J2EE application that has many JMS queues/listeners that wait for those replys.
Supposed the client interface is a web browser or other systems that demands synchronous response, what's the best way to do this?
Could web services be the answer?
Or the client application could just block and continue to poll for response until a reply is received or timeout. However, I don't think this would be a scalable solution.
Any help on this matter is much appreciated!
What component is your system invokes the asynchronous service? Is it an EJB component? A Servlet/JSP?
If it is an EJB, you may find this thread useful:
one time comment
> What's the best way to achieve synchronous behaviour to a system that only process requests asynchronously?
One way to interpret your question is: how do you develop logic in a familiar
synchronous fashion on top of a system that handles interactions asynchronously.
For example, is it possible to code a pair of asynchronous request and reply invocations as if one is merely writing procedural request call() followed by a receive() call. The trick is to abstract away the plumbing and arcane coding normally needed to implement asynchrony.
You may want to look at BPEL scenarios (an abstraction for Web service orchestration) that has both a XML flavor (BPEL4WS spec) and a Java flavor as well to achieve the above, not just for Web services but for JMS queues/topics, JCA, etc.