• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Understanding the flow of events ; use JMS or not  RSS feed

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to figure out the flow of events and whether JMS is needed in this scenario or not.



Make an Ajax POST Request, REST controller receives this request,a stored procedure is called which looks like the following:

 


As soon as the above SP is called, two things are returned with the help of `out` parameter, `p_out_message out` and `p_out_request_key`. As soon as this procedure is called, another stored procedure (let's call SP2)
starts asynchronously and this stored procedure (SP2) is responsible for gathering some data based on the `p_out_request_key`

So, basically, if another Ajax Post request comes in, another stored procedure will be launched asynchronously to gather data. This asynchronous SP is going to take a while (maybe hours).
Since my Ajax call is only interacting with the first stored procedure, I am assuming that my Ajax call won't get stuck waiting for response, right?

Meanwhile, I can query another table in the database `STATUS_CHECK` based on the `p_out_request_key`. I am going to see whether the request is `RUNNING`, `COMPLETE` or `ERRORED OUT`.

Scenario #1 : Figuring out JMS possibility

So, at this point of time, when the status of my request is `RUNNING`, could anyone tell me if introducing JMS would be a good idea?
Something like my JMS Producer could send message to the Queue, maybe `COMPLETE` message obtained from the `STATUS_CHECK` table ? As soon as my JMS  Receiver sees this `COMPLETE` message, I could
query the tables where I could find the data(this data was dumped by the asynchronous SP) I need and convert it into CSV and put it somewhere on the server.  
In this way, I won't need to do what I am trying to in Scenario #2 below. But I am not sure if the JMS approach I described here makes sense or not or if it's even worth going for it in this situation?



Scenario #2: Figuring out w/o JMS

In this scenarion, since the request is going to be in `RUNNING` state for few hours, I could possible check the status of my request from the UI by implementing heartbead in javascript(maybe every few minutes).
As soon as I see `COMPLETE`, I can query another tables (& do whatever I want) where data was dumped by the asynchronous stored procedure that started as I explained above.

But in order for this to happen, user would have to keep his/her browser open? I mean my webapp will be deployed as WAR in tomcat.


On front end, I am using HTML,CSS,jQuery,Javascript. Backend is Spring boot.

Please let me know if something is confusing. I'll clarify more on my situation.

P.S. I had kind of similar discussion on this thread here https://coderanch.com/t/706244/frameworks/message-send-JMS-request-running  but later on I was told about an asynchronous stored procedure which gets called as soon as first stored procedure is called. At the time when I wrote question in that thread, my
consideration was that as soon as the first stored procedure is called, it's going to take hours which is not the case in the current discussion and hence starting a new thread.
 
Saloon Keeper
Posts: 1112
36
IBM DB2 Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the whole process can last hours, no matter the actual sequence of nested stored procs, I would adopt JMS or some other server push technology.
"Polling" the database would work, but you will end running useless query against your database just to check compeltion of a task that, at least initially, it's unlikely to terminate soon.
Have a look at this example (powered by ActiveMQ). Never tried it myself, but it looks promising.
 
Jack Tauson
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Claude Moore wrote:If the whole process can last hours, no matter the actual sequence of nested stored procs, I would adopt JMS or some other server push technology.
"Polling" the database would work, but you will end running useless query against your database just to check compeltion of a task that, at least initially, it's unlikely to terminate soon.
Have a look at this example (powered by ActiveMQ). Never tried it myself, but it looks promising.



Thanks Claude. On the back end, still trying to figure out how to use JMS.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!