Package org.apache.kafka.streams.kstream
Class Branched<K,V>
java.lang.Object
org.apache.kafka.streams.kstream.Branched<K,V>
- Type Parameters:
K
- type of record keyV
- type of record value
public class Branched<K,V> extends Object
The
Branched
class is used to define the optional parameters when building branches with
BranchedKStream
.-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
Branched(String name, Function<? super KStream<K,V>,? extends KStream<K,V>> chainFunction, Consumer<? super KStream<K,V>> chainConsumer)
protected
Branched(Branched<K,V> branched)
Create an instance ofBranched
from an existing instance. -
Method Summary
Modifier and Type Method Description static <K, V> Branched<K,V>
as(String name)
Create an instance ofBranched
with provided branch name suffix.static <K, V> Branched<K,V>
withConsumer(Consumer<? super KStream<K,V>> chain, String name)
Create an instance ofBranched
with provided chain consumer and branch name suffix.static <K, V> Branched<K,V>
withConsumer(Consumer<KStream<K,V>> chain)
Create an instance ofBranched
with provided chain consumer.static <K, V> Branched<K,V>
withFunction(Function<? super KStream<K,V>,? extends KStream<K,V>> chain)
Create an instance ofBranched
with provided chain function.static <K, V> Branched<K,V>
withFunction(Function<? super KStream<K,V>,? extends KStream<K,V>> chain, String name)
Create an instance ofBranched
with provided chain function and branch name suffix.Branched<K,V>
withName(String name)
Configure the instance ofBranched
with a branch name suffix.
-
Field Details
-
name
-
chainFunction
-
chainConsumer
-
-
Constructor Details
-
Branched
-
Branched
Create an instance ofBranched
from an existing instance.- Parameters:
branched
- the instance ofBranched
to copy
-
-
Method Details
-
as
Create an instance ofBranched
with provided branch name suffix.- Type Parameters:
K
- key typeV
- value type- Parameters:
name
- the branch name suffix to be used (seeBranchedKStream
description for details)- Returns:
- a new instance of
Branched
-
withFunction
public static <K, V> Branched<K,V> withFunction(Function<? super KStream<K,V>,? extends KStream<K,V>> chain)Create an instance ofBranched
with provided chain function.- Type Parameters:
K
- key typeV
- value type- Parameters:
chain
- A function that will be applied to the branch. If the provided function returnsnull
, its result is ignored, otherwise it is added to theMap
returned byBranchedKStream.defaultBranch()
orBranchedKStream.noDefaultBranch()
(seeBranchedKStream
description for details).- Returns:
- a new instance of
Branched
-
withConsumer
Create an instance ofBranched
with provided chain consumer.- Type Parameters:
K
- key typeV
- value type- Parameters:
chain
- A consumer to which the branch will be sent. If a consumer is provided, the respective branch will not be added to the resultingMap
returned byBranchedKStream.defaultBranch()
orBranchedKStream.noDefaultBranch()
(seeBranchedKStream
description for details).- Returns:
- a new instance of
Branched
-
withFunction
public static <K, V> Branched<K,V> withFunction(Function<? super KStream<K,V>,? extends KStream<K,V>> chain, String name)Create an instance ofBranched
with provided chain function and branch name suffix.- Type Parameters:
K
- key typeV
- value type- Parameters:
chain
- A function that will be applied to the branch. If the provided function returnsnull
, its result is ignored, otherwise it is added to theMap
returned byBranchedKStream.defaultBranch()
orBranchedKStream.noDefaultBranch()
(seeBranchedKStream
description for details).name
- the branch name suffix to be used. Ifnull
, a default branch name suffix will be generated (seeBranchedKStream
description for details)- Returns:
- a new instance of
Branched
-
withConsumer
public static <K, V> Branched<K,V> withConsumer(Consumer<? super KStream<K,V>> chain, String name)Create an instance ofBranched
with provided chain consumer and branch name suffix.- Type Parameters:
K
- key typeV
- value type- Parameters:
chain
- A consumer to which the branch will be sent. If a non-null consumer is provided, the respective branch will not be added to the resultingMap
returned byBranchedKStream.defaultBranch()
orBranchedKStream.noDefaultBranch()
(seeBranchedKStream
description for details).name
- the branch name suffix to be used. Ifnull
, a default branch name suffix will be generated (seeBranchedKStream
description for details)- Returns:
- a new instance of
Branched
-
withName
Configure the instance ofBranched
with a branch name suffix.- Parameters:
name
- the branch name suffix to be used. Ifnull
a default branch name suffix will be generated (seeBranchedKStream
description for details)- Returns:
this
-