Class Branched<K,​V>

  • Type Parameters:
    K - type of record key
    V - 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.
    • Constructor Detail

      • Branched

        protected Branched​(Branched<K,​V> branched)
        Create an instance of Branched from an existing instance.
        Parameters:
        branched - the instance of Branched to copy
    • Method Detail

      • as

        public static <K,​V> Branched<K,​V> as​(String name)
        Create an instance of Branched with provided branch name suffix.
        Type Parameters:
        K - key type
        V - value type
        Parameters:
        name - the branch name suffix to be used (see BranchedKStream 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 of Branched with provided chain function.
        Type Parameters:
        K - key type
        V - value type
        Parameters:
        chain - A function that will be applied to the branch. If the provided function returns null, its result is ignored, otherwise it is added to the Map returned by BranchedKStream.defaultBranch() or BranchedKStream.noDefaultBranch() (see BranchedKStream description for details).
        Returns:
        a new instance of Branched
      • withConsumer

        public static <K,​V> Branched<K,​V> withConsumer​(Consumer<KStream<K,​V>> chain)
        Create an instance of Branched with provided chain consumer.
        Type Parameters:
        K - key type
        V - 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 resulting Map returned by BranchedKStream.defaultBranch() or BranchedKStream.noDefaultBranch() (see BranchedKStream 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 of Branched with provided chain function and branch name suffix.
        Type Parameters:
        K - key type
        V - value type
        Parameters:
        chain - A function that will be applied to the branch. If the provided function returns null, its result is ignored, otherwise it is added to the Map returned by BranchedKStream.defaultBranch() or BranchedKStream.noDefaultBranch() (see BranchedKStream description for details).
        name - the branch name suffix to be used. If null, a default branch name suffix will be generated (see BranchedKStream 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 of Branched with provided chain consumer and branch name suffix.
        Type Parameters:
        K - key type
        V - 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 resulting Map returned by BranchedKStream.defaultBranch() or BranchedKStream.noDefaultBranch() (see BranchedKStream description for details).
        name - the branch name suffix to be used. If null, a default branch name suffix will be generated (see BranchedKStream description for details)
        Returns:
        a new instance of Branched
      • withName

        public Branched<K,​V> withName​(String name)
        Configure the instance of Branched with a branch name suffix.
        Parameters:
        name - the branch name suffix to be used. If null a default branch name suffix will be generated (see BranchedKStream description for details)
        Returns:
        this