K - Type of keysV - Type of valuespublic final class KafkaStreamBrancher<K,V>
extends java.lang.Object
branches in
Kafka Streams processor topology.
Example of usage:
new KafkaStreamsBrancher<String, String>()
.branch((key, value) -> value.contains("A"), ks->ks.to("A"))
.branch((key, value) -> value.contains("B"), ks->ks.to("B"))
//default branch should not necessarily be defined in the end
.defaultBranch(ks->ks.to("C"))
.onTopOf(builder.stream("source"))
| Constructor and Description |
|---|
KafkaStreamBrancher() |
| Modifier and Type | Method and Description |
|---|---|
KafkaStreamBrancher<K,V> |
branch(org.apache.kafka.streams.kstream.Predicate<? super K,? super V> predicate,
java.util.function.Consumer<? super org.apache.kafka.streams.kstream.KStream<K,V>> consumer)
Defines a new branch.
|
KafkaStreamBrancher<K,V> |
defaultBranch(java.util.function.Consumer<? super org.apache.kafka.streams.kstream.KStream<K,V>> consumer)
Defines a default branch.
|
org.apache.kafka.streams.kstream.KStream<K,V> |
onTopOf(org.apache.kafka.streams.kstream.KStream<K,V> stream)
Terminating method that builds branches on top of given
KStream. |
public KafkaStreamBrancher<K,V> branch(org.apache.kafka.streams.kstream.Predicate<? super K,? super V> predicate, java.util.function.Consumer<? super org.apache.kafka.streams.kstream.KStream<K,V>> consumer)
predicate - Predicate instanceconsumer - The consumer of this branch's KStreamthispublic KafkaStreamBrancher<K,V> defaultBranch(java.util.function.Consumer<? super org.apache.kafka.streams.kstream.KStream<K,V>> consumer)
consumer - The consumer of this branch's KStreamthis