wood burning stoves*
The moose likes EJB and other Java EE Technologies and the fly likes Need a best messaging Solution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Need a best messaging Solution" Watch "Need a best messaging Solution" New topic
Author

Need a best messaging Solution

Neev Verma
Greenhorn

Joined: Jul 10, 2008
Posts: 2
Hi,

I need the better solution for my problem listed below.

Current scenario
We have a Web page through which End User submits a request. A single Request contains one or more than one row. Now first the request is get saved in two tables
1)Main table (contain unique request id with user details)
2)Details table (contain all rows related with request id)
and a XML message is also get prepared which contains the unique request id for that request. This XML message is send to a JMS queue and finally End User get intimated that he/she will get a mail when request get processed. (Request is get processed asynchronously)
From the queue another team picked up the message and fetched the details for that request from Details table and do some validation in Oracle apps through some concurrent program, this validation takes some time (few seconds to few minutes) and when completed they update a table (say Status) at there end. Now one another concurrent program is also running at there end which poll every second the Status table and check for newly completed request which in turn update the Details table with validation for each row for that request and End User get intimated through mail that his/her request validation is successful or not. If validations get failed then End User can go to Web Page and Open his/her request and see the errors for each row in a grid, he/she can also rectify the error and resubmit the request.

Required Scenario
Now we need to inform user synchronously in case validation is complete within one minute (say if a request contain 100 rows or records, we inform user synchronously) else we need to follow the same thing which we are following currently in above scenario.
We cannot use a solution in which we can create temporary queue and set it into a JMSReplyTo property of message and send the message to queue and the another team which picks up the message, reply back to that temporary queue with the validation details and we finally intimate user with result because the validation response involves more than one concurrent processes at there side that are independent of each other and are asynchronous. When a particular request is validated in one process, then that process can send message to JMSReplyTo property for the messages and not by another process which polls the Status table (it will not have the JMSReplyTo property available)

We have few option here and we need to find the best among them or if any other solution possible.
Case 1) we can directly submit the request to concurrent program in oracle apps and then we poll the Status table to check the status of that request; depending on the status we can decide further action to be taken.
In this case we need to make a connection with another database and continuously poll the table until we get the status of the request submitted by that User. Each user have to poll for there request, which exhausts our connection poll because validation takes few seconds to few minutes.

Case 2) we can send a message to one queue and another team perform all the validation and polling at there end (because everything is performed at there side) and reply back (when validation complete) to another response queue and we will use message selector to get the response for desired request id and take further action.

Please suggest which of the two cases is best regarding the performance or any other better solution if possible.

Thanks in advance.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

Neev,
Welcome to JavaRanch!

Two requirements jump out at me.
Now we need to inform user synchronously in case validation is complete within one minute (say if a request contain 100 rows or records, we inform user synchronously)

because validation takes few seconds to few minutes.


If validation could take a few minutes, this means you can't rely on doing a validation and replying within one minute. Why does it take so long to do a validation? Is there a way to make it faster? For example, have the process write a row to a "done" table and query that. This table could have a status of "success" or "valiation failed" to tell them apart. If you can get validation down to a couple seconds, you will be able to query for validation synchronously. Which will greatly simplify your design for validation along with getting unneeded (and redundant) work out of the picture.

The other part is figuring out whether to do the actual work synchronously or asynchronously. Is it possible to determine whether a request is big or small before starting it? Maybe from the size of the request?


[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
Neev Verma
Greenhorn

Joined: Jul 10, 2008
Posts: 2
Thanks Jeanne for your response.

If validation could take a few minutes, this means you can't rely on doing a validation and replying within one minute.


The other part is figuring out whether to do the actual work synchronously or asynchronously. Is it possible to determine whether a request is big or small before starting it? Maybe from the size of the request?


We will fix the size of request say if request have less then or equal to 100 rows, then we do Synchronously else we process the request Asynchronously.

Why does it take so long to do a validation?


Each request can have multiple rows and each rows have multiple columns. For each single column validation (Server side validation) we need to validate columns value from more then one table or views. so it take time if request is larger.

Is there a way to make it faster?

It is already optimized.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need a best messaging Solution