Skip to content

Instantly share code, notes, and snippets.

@isaacmg
Created January 30, 2017 05:37
Show Gist options
  • Save isaacmg/7975f9be7ae6d8bf3a0c9538ce9764cb to your computer and use it in GitHub Desktop.
Save isaacmg/7975f9be7ae6d8bf3a0c9538ce9764cb to your computer and use it in GitHub Desktop.
Kafka Json
List<String> jsonString = getDataString(s);
KafkaProducer<String,String> producer = new KafkaProducer<String,String>(props);
for(String message:jsonString)
{
ProducerRecord<String,String> producerRecord = new ProducerRecord<String,String>("test", "a river", message);
producer.send(producerRecord);
}
producer.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment