class BranchedKStream[K, V] extends AnyRef
Branches the records in the original stream based on the predicates supplied for the branch definitions.
Branches are defined with branch or defaultBranch methods. Each record is evaluated against the predicates
supplied via Branched parameters, and is routed to the first branch for which its respective predicate
evaluates to true
. If a record does not match any predicates, it will be routed to the default branch,
or dropped if no default branch is created.
Each branch (which is a KStream instance) then can be processed either by
a function or a consumer provided via a Branched
parameter. If certain conditions are met, it also can be accessed from the Map
returned by
an optional defaultBranch or noDefaultBranch method call.
The branching happens on a first match basis: A record in the original stream is assigned to the corresponding result stream for the first predicate that evaluates to true, and is assigned to this stream only. If you need to route a record to multiple streams, you can apply multiple KStream.filter operators to the same KStream instance, one for each predicate, instead of branching.
The process of routing the records to different branches is a stateless record-by-record operation.
- K
Type of keys
- V
Type of values
- Alphabetic
- By Inheritance
- BranchedKStream
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new BranchedKStream(inner: kstream.BranchedKStream[K, V])
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def branch(predicate: (K, V) => Boolean, branched: Branched[K, V]): BranchedKStream[K, V]
Define a branch for records that match the predicate.
Define a branch for records that match the predicate.
- predicate
A predicate against which each record will be evaluated. If this predicate returns
true
for a given record, the record will be routed to the current branch and will not be evaluated against the predicates for the remaining branches.- branched
A Branched parameter, that allows to define a branch name, an in-place branch consumer or branch mapper (see code examples for BranchedKStream)
- returns
this
to facilitate method chaining
- def branch(predicate: (K, V) => Boolean): BranchedKStream[K, V]
Define a branch for records that match the predicate.
Define a branch for records that match the predicate.
- predicate
A predicate against which each record will be evaluated. If this predicate returns
true
for a given record, the record will be routed to the current branch and will not be evaluated against the predicates for the remaining branches.- returns
this
to facilitate method chaining
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def defaultBranch(branched: Branched[K, V]): Map[String, KStream[K, V]]
Finalize the construction of branches and defines the default branch for the messages not intercepted by other branches.
Finalize the construction of branches and defines the default branch for the messages not intercepted by other branches. Calling defaultBranch or noDefaultBranch is optional.
- branched
A Branched parameter, that allows to define a branch name, an in-place branch consumer or branch mapper for BranchedKStream.
- returns
Map of named branches. For rules of forming the resulting map, see BranchedKStream description.
- def defaultBranch(): Map[String, KStream[K, V]]
Finalize the construction of branches and defines the default branch for the messages not intercepted by other branches.
Finalize the construction of branches and defines the default branch for the messages not intercepted by other branches. Calling defaultBranch or noDefaultBranch is optional.
- returns
Map of named branches. For rules of forming the resulting map, see BranchedKStream description.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val inner: kstream.BranchedKStream[K, V]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noDefaultBranch(): Map[String, KStream[K, V]]
Finalizes the construction of branches without forming a default branch.
Finalizes the construction of branches without forming a default branch.
- returns
Map of named branches. For rules of forming the resulting map, see BranchedKStream description.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()