private void publishCIPendingEvents() {
   // logger.info("start reading" + eventType);
   isRunning = true;
   lastRun = System.currentTimeMillis();
   List<CMSEvent> events = ciEventReader.getEvents();
   while (events.size() > 0) {
     logger.info("Got " + events.size() + " ci events; Using CIEventPublisher");
     for (CMSEvent event : events) {
       String action = event.getHeaders().get("action");
       try {
         if (event.getPayload() != null || "delete".equals(action)) {
           eventPublisher.publishCIEvents(event);
         } else {
           logger.info("Event payload found null for " + event.getHeaders());
         }
         ciEventReader.removeEvent(event.getEventId());
       } catch (JMSException e) {
         e.printStackTrace();
         logger.error(e.getMessage(), e);
         // stopPublishing();
         return;
       }
     }
     events = ciEventReader.getEvents();
   }
   // System.out.println("Done;");
 }
 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;");
 }