Last active
July 7, 2022 19:21
-
-
Save a-agmon/22c8c4336d6f443d50181c145c300e44 to your computer and use it in GitHub Desktop.
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
def getStreamTopology(inputTopic:String):Topology = { | |
val builder = new StreamsBuilder() | |
val reqStream = builder.stream[String, PredictRequest](inputTopic) | |
reqStream | |
.map( (_, request) => { | |
Classifier.predict(request.recordID, request.featuresVector) | |
}) | |
.split() | |
.branch((key, risk) => risk >= 0.5 , | |
Branched.withConsumer(stream => stream.to("suspects-topic"))) | |
.branch((key, risk) => risk < 0.5 , | |
Branched.withConsumer(stream => stream.to("regular-topic"))) | |
builder.build() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment