public <T> T execute(Function<Consumer, T> function) {
      // Kafka consumer is not thread-safe
      synchronized (kafkaConsumer) {
        return function.apply(kafkaConsumer);
      }
    }
Executes the lambda function comprised of kafka-consumer operations in a thread-safe manner
and returns the result of the execution.

@param function accepts the kafka consumer as argument and returns a result after executing a
                sequence of operations on a kafka-broker.
@param <T> the return type of the lambda function.
@return the result of executing the lambda function.
samza-kafka/src/main/java/org/apache/samza/system/kafka/KafkaSystemAdmin.java