public void sendMessages(List<ProducerRecord<String,String>> records){
  Producer<String,String> producer=new KafkaProducer<>(getProducerConfig());
  for (  ProducerRecord<String,String> rec : records)   producer.send(rec);
  producer.flush();
  producer.close();
}

public void sendMessages ( List < ProducerRecord < String , String > > records ) { Producer < String , String > producer = new KafkaProducer < > ( getProducerConfig ( ) ) ; for ( ProducerRecord < String , String > rec : records ) producer . send ( rec ) ; producer . flush ( ) ; producer . close ( ) ; }
sends a message to kafka broker .
