Skip to content

Instantly share code, notes, and snippets.

@mgeerling
Created October 31, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgeerling/86f76e2288147c5d31a92044331c21f8 to your computer and use it in GitHub Desktop.
Save mgeerling/86f76e2288147c5d31a92044331c21f8 to your computer and use it in GitHub Desktop.
var Kafka = require('no-kafka');
var kafkaTopic = 'kafkaTest';
var producer = new Kafka.Producer();
var messageBuffer = ["msg1","msg2","msg3"];
return producer.init().then(messageBuffer.forEach(function(index){
return producer.send({
topic: kafkaTopic,
partition: 0,
message: {
value: index
}
});
}))
.then(function (result) {
//i just changed this line to be more positive of the outcome
console.log("mission complete");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment