I have this SQL query which is used in the code below.
Code:
SELECT STATUS FROM STATUS_CHECK WHERE uniqueuId = ?
Different values of STATUS are `NOT STARTED`, `RUNNING`, `COMPLETE`, `ERROR`.

I need to keep checking the value of STATUS from time to time and do some operations as soon as I find `COMPLETE` and wondering what approach I should following to achieve my task. Any ideas in which direction I could proceed?

Right now, in the code below, I only see `NOT STARTED` and my code exits.And I am not sure how to check the status without calling the webservice again after sometime to make sure that it changed to `COMPLETE` so that I could do some operations on it.

Let's say I have the following controller,DAO and DAoImple to get the `STATUS`


Controller:

Code:
@RequestMapping(value = "/statusCheck", method = RequestMethod.POST)
        public void statusCheck
         (
         @RequestParam(value = "id", defaultValue = "") String id
         
        ) {
        try {
           StatusDao sDao = (StatusDao) context.getBean("sDao");
           sDao.statusLookUp(id);
        } catch (Throwable th) {th.printStackTrace();}
       }

Data Access Object(DAO):

Code:
public interface StatusDao {
        void statusLookUp(String id) throws DaoException;
    }
DAO Impl:

Code:
public class StatusDaoImpl implements StatusDao {
        
         public void setDataSource(DataSource dataSource) {
          jdbcTemplate = new JdbcTemplate(dataSource);
         }
        
            
         @Override
         public void statusLookUp(String id) throws DaoException {
        
          DataSource ds = null;
          Connection conn = null;
          PreparedStatement pstmt = null;
          CallableStatement cStmt = null;
          ResultSet rs = null;
        
          try {
           ds = jdbcTemplate.getDataSource();
           conn = ds.getConnection();
           cStmt = conn.prepareCall("{call STATUS_RETRIEVER.GET_STATUS(?)}");
           cStmt.setString(1, id);
           cStmt.registerOutParameter(2, Types.VARCHAR);
           
           int uniqueId = cStmt.getInt(2);
         
           pstmt = conn.prepareStatement("SELECT STATUS FROM STATUS_CHECK WHERE uniqueuId=?");
           pstmt.setInt(1, uniqueId);
           rs = pstmt.executeQuery();
           rs.next();
    	   
           String status = rs.getString("STATUS");
           System.out.println("The status received is as follows:");
           System.out.println(status);
    	   
          } catch (Throwable th) {
           throw new DaoException(th.getMessage(), th);
          }
         }
    
    }
Is it possible to use JMS (ApacheMQ) in this scenario?