/** * Default Constructor (Uses SchedulerConstants.username and SchedulerConstants.password */ public ProcessHL7InQueueTask() { if (processor == null) { processor = new HL7InQueueProcessor(); } }
/** * Starts up a thread to process all existing HL7InQueue entries */ public void processHL7InQueue() throws HL7Exception { synchronized (lock) { if (isRunning) { log.warn("HL7 processor aborting (another processor already running)"); return; } isRunning = true; } try { log.debug("Start processing hl7 in queue"); while (processNextHL7InQueue()) { // loop until queue is empty } log.debug("Done processing hl7 in queue"); } finally { isRunning = false; } }
/** * Transform the next pending HL7 inbound queue entry. If there are no pending items in the * queue, this method simply returns quietly. * * @return true if a queue entry was processed, false if queue was empty */ public boolean processNextHL7InQueue() { boolean entryProcessed = false; HL7Service hl7Service = Context.getHL7Service(); HL7InQueue hl7InQueue = hl7Service.getNextHL7InQueue(); if (hl7InQueue != null) { processHL7InQueue(hl7InQueue); entryProcessed = true; } return entryProcessed; }
log.error("Unable to process hl7 in queue", e); setCount(count + 1); if (count > 25) {
/** * Process the next form entry in the database and then remove the form entry from the database. */ @Override public void execute() { Context.openSession(); try { log.debug("Processing HL7 queue ... "); processor.processHL7InQueue(); } catch (HL7Exception e) { log.error("Error running hl7 in queue task", e); throw new APIException("Hl7inQueue.error.running", null, e); } finally { Context.closeSession(); } }