Last active
October 16, 2018 16:55
-
-
Save adekunleba/fcb0b7cc7d948fd19bceee1ab8a7f9ad to your computer and use it in GitHub Desktop.
Sample producer to a Kafka cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Given an incoming message to train a Streaming Machine Learning Model | |
| val signaturesToTrainModelsOn = 1 to max | |
| val trainTopic = "signatures" | |
| signaturesToTrainModelsOn.foreach { n => | |
| streams.send(new ProducerRecord(trainTopic, "sigs", s"$n")) | |
| } | |
| //Given an incoming message to predict | |
| val signaturesToPredictOn = maths.random() | |
| val testTopic = "predictionSignatures" | |
| signaturesToPredictOn.foreach { sig => | |
| streams.send(new ProducerRecord(testTopic, "testsigs", s"$sig")) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment