@Override
 public void shutdown() {
   producer.complete();
   try {
     boolean isDone = countDownLatch.await(5, TimeUnit.MINUTES);
     if (!isDone) {
       LOG.warn("Pipeline is still in active state: {} after 5 minutes");
     } else {
       LOG.info("Destroy() on stages is complete");
     }
   } catch (InterruptedException e) {
     LOG.warn("Thread interrupted while waiting on receving the done flag" + e, e);
   }
 }
 @Override
 public boolean inErrorState() {
   return producer.inErrorState() || consumer.inErrorState();
 }
 @Override
 public void destroy() {
   producer.complete();
   super.destroy();
 }
 @Override
 public void put(List<Map.Entry> batch) throws InterruptedException {
   producer.put(new OffsetAndResult<>(recordsProduced, batch));
   recordsProduced += batch.size();
 }