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 protectedBranched(String name, Function<? super KStream<K,V>,? extends KStream<K,V>> chainFunction, Consumer<? super KStream<K,V>> chainConsumer)protectedBranched(Branched<K,V> branched)Create an instance ofBranchedfrom an existing instance. -
Method Summary
Modifier and Type Method Description static <K, V> Branched<K,V>as(String name)Create an instance ofBranchedwith provided branch name suffix.static <K, V> Branched<K,V>withConsumer(Consumer<? super KStream<K,V>> chain, String name)Create an instance ofBranchedwith provided chain consumer and branch name suffix.static <K, V> Branched<K,V>withConsumer(Consumer<KStream<K,V>> chain)Create an instance ofBranchedwith provided chain consumer.static <K, V> Branched<K,V>withFunction(Function<? super KStream<K,V>,? extends KStream<K,V>> chain)Create an instance ofBranchedwith 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 ofBranchedwith provided chain function and branch name suffix.Branched<K,V>withName(String name)Configure the instance ofBranchedwith a branch name suffix.
-
Field Details
-
name
-
chainFunction
-
chainConsumer
-
-
Constructor Details
-
Branched
-
Branched
Create an instance ofBranchedfrom an existing instance.- Parameters:
branched- the instance ofBranchedto copy
-
-
Method Details
-
as
Create an instance ofBranchedwith provided branch name suffix.- Type Parameters:
K- key typeV- value type- Parameters:
name- the branch name suffix to be used (seeBranchedKStreamdescription 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 ofBranchedwith 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 theMapreturned byBranchedKStream.defaultBranch()orBranchedKStream.noDefaultBranch()(seeBranchedKStreamdescription for details).- Returns:
- a new instance of
Branched
-
withConsumer
Create an instance ofBranchedwith 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 resultingMapreturned byBranchedKStream.defaultBranch()orBranchedKStream.noDefaultBranch()(seeBranchedKStreamdescription 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 ofBranchedwith 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 theMapreturned byBranchedKStream.defaultBranch()orBranchedKStream.noDefaultBranch()(seeBranchedKStreamdescription for details).name- the branch name suffix to be used. Ifnull, a default branch name suffix will be generated (seeBranchedKStreamdescription 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 ofBranchedwith 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 resultingMapreturned byBranchedKStream.defaultBranch()orBranchedKStream.noDefaultBranch()(seeBranchedKStreamdescription for details).name- the branch name suffix to be used. Ifnull, a default branch name suffix will be generated (seeBranchedKStreamdescription for details)- Returns:
- a new instance of
Branched
-
withName
Configure the instance ofBranchedwith a branch name suffix.- Parameters:
name- the branch name suffix to be used. Ifnulla default branch name suffix will be generated (seeBranchedKStreamdescription for details)- Returns:
this
-