private void publishControllerPendingEvents() { isRunning = true; lastRun = System.currentTimeMillis(); List<CMSEvent> events = controllerEventReader.getEvents(); while (events.size() > 0) { logger.info("Got " + events.size() + " controller events; Using ControllerEventPublisher"); for (CMSEvent event : events) { try { if (event.getPayload() != null) { eventPublisher.publishControllerEvents(event); } else { logger.info("Event payload found null for " + event.getHeaders()); } controllerEventReader.removeEvent(event.getEventId()); } catch (JMSException e) { e.printStackTrace(); logger.error(e.getMessage(), e); // stopPublishing(); return; } } events = controllerEventReader.getEvents(); } // System.out.println("Done;"); }
public PubStatus getStatus() { PubStatus stat = new PubStatus(); stat.setQueueBacklog(controllerEventReader.getQueueBacklog()); stat.setCiEventsQueueBacklog(ciEventReader.getQueueBacklog()); stat.setRunning(isRunning); Date dateLastRun = new Date(lastRun); stat.setLastRun(dateLastRun); return stat; }