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

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BranchedKStream
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new BranchedKStream(inner: kstream.BranchedKStream[K, V])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. 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

  6. 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

  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. 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.

  9. 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.

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. val inner: kstream.BranchedKStream[K, V]
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. 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.

  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped