aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Synchronous JMS for request response mechanism (online market place) with <5 secs response time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Synchronous JMS for request response mechanism (online market place) with <5 secs response time" Watch "Synchronous JMS for request response mechanism (online market place) with <5 secs response time" New topic
Author

Synchronous JMS for request response mechanism (online market place) with <5 secs response time

Madhu Maniganta
Greenhorn

Joined: Nov 27, 2010
Posts: 14
Hi All,
I am working on my part 2 assignment of SCEA and have a question about synchronous JMS communication BOTH WAYS between client and external system. During a single user session (say click of a button and before showing response screen) all this happen should happen within 5 secs for the client to see the response. Do you guys think this is possible?
Thanks,
Madhu.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Madhu,
Not reliably. I wouldn't wait on a queue while the user is actively waiting for a response.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Madhu Maniganta
Greenhorn

Joined: Nov 27, 2010
Posts: 14
Jeanne,
Thanks for the response, but my assignment clearly mentions for such requirement. I am worried.
Thanks,
Madhu.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Madhu Maniganta wrote:but my assignment clearly mentions for such requirement. I am worried.

Are you sure? It specifically said the user clicks submit, a message goes on a queue, another messages goes on a queue and then the user sees a result? That doesn't sound like a business requirement to me. A business requirement is something like "the user submits the form and receives a response with the success or failure of the external credit card system." Queues are one solution. I can think of several others.
Madhu Maniganta
Greenhorn

Joined: Nov 27, 2010
Posts: 14
Jeanne,
For an online shopping application scenario it says "The manufacturers can be contacted using jms", and in check availability use case "check availability of product with manufacturers before adding to cart" and so it needs to be synchronous call as per my understanding...let me know if Iam missing something here...
Thanks,
Madhu
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

I can't think of a way of answering that doesn't involve providing too much help with the assignment. Try thinking about alternatives that involve using JMS but not having the user sitting around waiting for a response.
Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
JMS is for asynchronous communication generally, while your scenario requires synchronous communication: check-and-act. There is obvious conflict here, right? As a architect, what are you going to do? Tell me your choices before you make a decision.
rohid dev
Greenhorn

Joined: Dec 07, 2010
Posts: 7
You can use JMS for synchronous messaging.
Also 5 sec response time is possible depends upon the resources used
The receive method can be used in several ways to perform a synchronous receive. If you specify no arguments or an argument of 0, the method blocks indefinitely until a message arrives:

Message m = queueReceiver.receive();

Message m = queueReceiver.receive(0);

For a simple client program, this may not matter. But if you do not want your program to consume system resources unnecessarily, use a timed synchronous receive. Do one of the following:

Call the receive method with a timeout argument greater than 0:
Message m = queueReceiver.receive(1); // 1 millisecond

For SCEA part 2 - make sure you have specified all your assumptions.

reference
http://download.oracle.com/javaee/1.3/jms/tutorial/1_3_1-fcs/doc/client.html


SCEA (5.0), SCWCD (5.0), SCBCD (5.0), SCDJWS (5.0)
Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
rohid dev wrote:You can use JMS for synchronous messaging.
Also 5 sec response time is possible depends upon the resources used
The receive method can be used in several ways to perform a synchronous receive. If you specify no arguments or an argument of 0, the method blocks indefinitely until a message arrives:

Message m = queueReceiver.receive();

Message m = queueReceiver.receive(0);

For a simple client program, this may not matter. But if you do not want your program to consume system resources unnecessarily, use a timed synchronous receive. Do one of the following:

Call the receive method with a timeout argument greater than 0:
Message m = queueReceiver.receive(1); // 1 millisecond

For SCEA part 2 - make sure you have specified all your assumptions.

reference
http://download.oracle.com/javaee/1.3/jms/tutorial/1_3_1-fcs/doc/client.html


Basically, I think what you are describing is one of the asynchronous scenario. You sent msg using slsb, receiving it through MDB.
rohid dev
Greenhorn

Joined: Dec 07, 2010
Posts: 7
The application after sending out order information to a Queue for further processing will then use

QueueReceiver object to receive OrderConfirmation information from another queue

Bigwood Liu
Ranch Hand

Joined: Feb 26, 2003
Posts: 240
True. You can use JMS this way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Synchronous JMS for request response mechanism (online market place) with <5 secs response time