• 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

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

 
Ranch Hand
Posts: 96
  • 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: 96
  • 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.


     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!