Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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

 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Spring scheduler :

https://spring.io/guides/gs/scheduling-tasks/
 
Jack Tauson
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic