/** * Sends a JMS message over the statusUpdateChannel indicating the status of a crawled resource. * * @param jobID - the unique job name from the original submission message. * @param uri - the URI that was crawled. * @param status - status code. */ public void sendStatusUpdate(String jobID, String uri, int status) { try { JMSSender qsender = msgService.getJMSSender(statusUpdateChannel); UrlCrawledMsg msg = new UrlCrawledMsg(qsender, jobID, uri, status); msg.send(); } catch (JMSException e) { e.printStackTrace(); } } // - sendStatusUpdate
/** * Sends a JMS message over the statusUpdateChannel indicating that the specified job has * completed. * * @param jobID * @param url */ public void sendJobComplete(String jobID, String url) { try { JMSSender qsender = msgService.getJMSSender(statusUpdateChannel); SubmissionJobCompleteMsg msg = new SubmissionJobCompleteMsg(qsender, jobID, url, 0); msg.send(); } catch (JMSException e) { e.printStackTrace(); } } // - sendJobComplete
/** * Sends a JMS message over the ingestionChannel indicating that new resources are ready to * ingest. * * @param jobID - the unique job name from the original submission message. * @param filePath - relative path from repository root where the file can be found. * @param metaPath - relative path from the repository root where the metadata file can be found. * @param type - resource type (from CSXConstants). */ public void notifyIngestion(String jobID, String filePath, String metaPath, String type) { try { JMSSender qsender = msgService.getJMSSender(ingestionChannel); NewRecordToIngestMsg msg = new NewRecordToIngestMsg(qsender, jobID, repositoryID, filePath, metaPath, type); msg.send(); } catch (JMSException e) { e.printStackTrace(); } } // - notifyIngestion
/** * Sends a JMS message over the statusUpdateChannel indicating that the specified job has started. * * @param jobID * @param url */ public void sendJobStarted(String jobID, String url) { try { System.err.println("SENDING JOB STARTED!!!"); JMSSender qsender = msgService.getJMSSender(statusUpdateChannel); SubmissionStartedMsg msg = new SubmissionStartedMsg(qsender, jobID, url, 0); msg.send(); } catch (JMSException e) { e.printStackTrace(); } } // - sendJobStarted
/** * Sets up the JMS service and starts a thread to poll for a Heritrix instance. * * @param pLabel - just a junk parameter to allow for both public and private constructors for a * singleton instance. */ private JMSInterface(String pLabel) { try { ConfigurationManager cm = new ConfigurationManager(); newSubmissionsChannel = cm.getString("newSubmissionsChannel", accessKey); statusUpdateChannel = cm.getString("statusUpdateChannel", accessKey); ingestionChannel = cm.getString("ingestionChannel", accessKey); repositoryID = cm.getString("repositoryID", accessKey); submissionProfile = cm.getString("submissionProfile", accessKey); msgService = new MsgService(); msgService.setMessageListener(newSubmissionsChannel, this); RegistrationThread rThread = new RegistrationThread(); rThread.start(); } catch (Exception e) { e.printStackTrace(); } } // - private JMSInterface
/** Servlet method for gracefully shutting down the JMS MsgService. */ public void destroy() { if (msgService != null) { msgService.close(); } }