@Override
  public void execute(HttpServletRequest req, HttpServletResponse resp, ConfigService configService)
      throws IOException {
    String pvName = req.getParameter("pv");
    if (pvName == null || pvName.equals("")) {
      resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }

    Event event = configService.getETLLookup().getLatestEventFromDataStores(pvName);
    if (event != null) {
      resp.setContentType(MimeTypeConstants.APPLICATION_JSON);
      HashMap<String, String> result = new HashMap<String, String>();
      result.put("timestamp", TimeUtils.convertToISO8601String(event.getEventTimeStamp()));
      try (PrintWriter out = resp.getWriter()) {
        out.println(JSONValue.toJSONString(result));
      }
    } else {
      resp.sendError(HttpServletResponse.SC_NOT_FOUND);
      return;
    }
  }
  private void consumeEventStreamAndOutputToMimeResponse(EventStream strm) throws Exception {
    try {
      int eventsInCurrentStream = 0;
      for (Event e : strm) {
        try {
          eventsInCurrentStream++;

          if (!haveIpushedTheFirstEvent && firstEvent == null) {
            logger.debug(
                "Making a copy of the first event "
                    + TimeUtils.convertToHumanReadableString(e.getEventTimeStamp()));
            firstEvent = e.makeClone();
            continue;
          }

          if (!haveIpushedTheFirstEvent) {
            if (e.getEventTimeStamp().before(this.startTimeStamp)) {
              logger.debug(
                  "Making a copy of another event "
                      + TimeUtils.convertToHumanReadableString(e.getEventTimeStamp()));
              firstEvent = e.makeClone();
              continue;
            } else {
              haveIpushedTheFirstEvent = true;
              logger.debug(
                  "Consuming first and current events "
                      + TimeUtils.convertToHumanReadableString(e.getEventTimeStamp()));
              mimeresponse.consumeEvent(firstEvent);
              timestampOfLastEvent = firstEvent.getEventTimeStamp();
              totalEvents++;
              if (!e.getEventTimeStamp().after(timestampOfLastEvent)) {
                logger.debug(
                    "After sending first event, current event is not after the first event. Skipping "
                        + TimeUtils.convertToHumanReadableString(e.getEventTimeStamp()));
                skippedEvents++;
                continue;
              } else {
                mimeresponse.consumeEvent(e);
                totalEvents++;
                timestampOfLastEvent = e.getEventTimeStamp();
                continue;
              }
            }
          }

          if (amIDeduping) {
            comparedEvents++;
            if (!e.getEventTimeStamp().after(timestampOfLastEvent)) {
              skippedEvents++;
              continue;
            } else {
              amIDeduping = false;
              mimeresponse.consumeEvent(e);
              timestampOfLastEvent = e.getEventTimeStamp();
              totalEvents++;
            }
          } else {
            mimeresponse.consumeEvent(e);
            timestampOfLastEvent = e.getEventTimeStamp();
            totalEvents++;
          }
        } catch (InvalidProtocolBufferException | PBParseException ex) {
          logger.warn(ex.getMessage(), ex);
          if (this.mimeresponse instanceof ExceptionCommunicator) {
            ((ExceptionCommunicator) this.mimeresponse).comminucateException(ex);
          }
          skippedEvents++;
        }
      }

      if (eventsInCurrentStream == 0) {
        logger.info(
            "The stream from "
                + ((strm.getDescription() != null) ? strm.getDescription().getSource() : "Unknown")
                + " was an empty stream.");
      }

      // We start deduping at the boundaries of event streams.
      // This does not apply until we have pushed the first event out..
      if (haveIpushedTheFirstEvent) startDeduping();
    } catch (InvalidProtocolBufferException | PBParseException ex) {
      logger.warn(ex.getMessage(), ex);
      if (this.mimeresponse instanceof ExceptionCommunicator) {
        ((ExceptionCommunicator) this.mimeresponse).comminucateException(ex);
      }
      skippedEvents++;
    }
  }