Example #1
0
 private long getCommittedTimestampMillis(TopicPartition topicPartition) throws Exception {
   Message message = mKafkaClient.getCommittedMessage(topicPartition);
   if (message == null) {
     LOG.error(
         "No message found for topic "
             + topicPartition.getTopic()
             + " partition "
             + topicPartition.getPartition());
     return -1;
   }
   return mMessageParser.extractTimestampMillis(message);
 }
Example #2
0
 private long getLastTimestampMillis(TopicPartition topicPartition) throws Exception {
   Message message = mKafkaClient.getLastMessage(topicPartition);
   if (message == null) {
     // This will happen if no messages have been posted to the given topic partition.
     LOG.error(
         "No message found for topic "
             + topicPartition.getTopic()
             + " partition "
             + topicPartition.getPartition());
     return -1;
   }
   return mMessageParser.extractTimestampMillis(message);
 }