private void deprecationCheck()

in ingestion-beam/src/main/java/com/mozilla/telemetry/decoder/ParsePayload.java [423:444]


  private void deprecationCheck(Map<String, String> attributes,
      PipelineMetadataStore.PipelineMetadata meta) throws DeprecatedMessageException {
    if (meta.expiration_policy() != null
        && meta.expiration_policy().collect_through_date() != null) {

      LocalDate collectThroughDate;
      try {
        collectThroughDate = LocalDate.parse(meta.expiration_policy().collect_through_date(),
            DateTimeFormatter.ISO_LOCAL_DATE);
      } catch (DateTimeParseException e) {
        collectThroughDate = null;
      }

      Instant submissionInstant = Time
          .parseAsInstantOrNull(attributes.get(Attribute.SUBMISSION_TIMESTAMP));

      if (submissionInstant != null && collectThroughDate != null
          && LocalDate.ofInstant(submissionInstant, ZoneOffset.UTC).isAfter(collectThroughDate)) {
        throw new DeprecatedMessageException();
      }
    }
  }