code: public <K, V> ListenableFuture<List<ConsumerRecord<K, V>>> consume(String topic, KafkaConsumer<K, V> consumer, int numMessagesToConsume) {
          consumer.subscribe(Lists.newArrayList(topic));
          ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
          return executor.submit(new RecordConsumer<>(numMessagesToConsume, consumer));
      }
docs: Attempt to consume the specified number of messages
  
  @param topic                Topic to consume
  @param consumer             Consumer to use
  @param numMessagesToConsume Number of messages to consume
  @param <K>                  Type of Key
  @param <V>                  Type of Value
  @return ListenableFuture