Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Check the value of colum at regular interval to get the desired value

 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following method (processFebMessage) in my class and basically, I am sending message parameter obtained form the JMSListner to the sendMessage method
to retrieve the value of `REQUEST_STATUS` from the emp.data_request table as shown in the RequestDaoImpl class below.

The different `REQUEST_STATUS` values are RUNNING, COMPLETE, ERRONEOUS

AS soon as I rung my application, I could see the status RUNNING but after sometime it changes to COMPLETE.

I am wondering what's the best approach to keep on checking the status from the table again and again ? I want to do some operations
as soon as I get `COMPLETE`.



RequestDao



RequestDaoImpl:

 
Greenhorn
Posts: 17
Java Linux
 
Jack Tauson
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

SaurabhRc Jain wrote:You can use Spring scheduler :

https://spring.io/guides/gs/scheduling-tasks/



Can you elaborate more on this, how it is going to fit in my situation?
 
SaurabhRc Jain
Greenhorn
Posts: 17
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are few things not specified in your post:
  • Which process is inserting data in data_request table?
  • Which process is updating the status to COMPLETE in data_request table?


  • Assuming that the status is marked as COMPLETE by an asynch process. And you don't have any information on when that happens.

    Create another table 'request_process' to maintain the process_status.
    In method processFebMessage(), insert a record in 'request_process' with process_status as NEW.

    Create a scheduler to run periodically:
  • Lookup records in 'request_process' table in NEW process_status
  • Check the REQUEST_STATUS from data_request table
  • For COMPLETE case, do whatever you need to do and mark DONE in 'request_process' table


  • Another approach could be that scheduler simply looks up all records in COMPLETE REQUEST_STATUS without the need of additional table 'request_process'.

    If you can provide details about your project requirement & design, then we can think of a simpler solution.


     
    Do not meddle in the affairs of dragons - for you are crunchy and good with ketchup. Crunchy tiny ad:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic