Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current state"Under Discussion"

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Today we have multiple ways to infer and inherit serde along the topology, and only fall back to the configured serde when inference does not apply. More specifically, the serde overriding precedence is the following:

...

So I'd propose we augment the topology description with serde information on place that would execute serde, i.e. source / sink topics and state store operators.


Public Interfaces

The generated String from TopologyDescription#toString would be augmented with the serde information in the form of: 

...

Code Block
languagejava
    interface Processor extends Node {
        /**
         * The names of all connected stores.
         * @return set of store names
         */
        @Deprecated
        Set<String> stores();

        /**
         * The namesset of all connected stores.
         * @return set of stores
         */
        Set<Store> storeSet();                    <---- NEW FUNC
    }

    /**
     * A state store of a topology                    <---- NEW CLASS
     */
    interface Store {
        /**
         * Name of the stat store
         */
        String name();

        /**
         * Name of the corresponding changelog topic of this store.
         * @return name of the changelog topic; null if the store is not logging enabled
         */
        String changelogTopic();

        /**
         * Names of serde classes that are associated with the store
         */
        List<String> serdeNames();
    }

    interface Source extends Node {
        ....

        /**
         * Names of key serde class used for this source node
         */
        String keySerdeName();                    <---- NEW FUNC

        /**
         * Names of value serde class used for this source node
         */
        String valueSerdeName();                    <---- NEW FUNC
    }

    interface Sink extends Node {
        ....

        /**
         * Names of key serde class used for this source node
         */
        String keySerdeName();                    <---- NEW FUNC

        /**
         * Names of value serde class used for this source node
         */
        String valueSerdeName();                    <---- NEW FUNC
    }

    interface Subtopology {
        /**
         * Internally assigned unique ID.
         * @return the ID of the sub-topology
         */
        int id();

        /**
         * All nodes of this sub-topology.
         * @return set of all nodes within the sub-topology
         */
        Set<Node> nodes();

        /**
         * All source nodes of this sub-topology.
         * @return set of all source nodes within the sub-topology
         */
        Set<Source> sourceNodes();

        /**
         * All sink nodes of this sub-topology.
         * @return set of all sink nodes within the sub-topology
         */
        Set<Sink> sinkNodes();

        /**
         * All state stores of this sub-topology.
         * @return set of all state stores within the sub-topology
         */
        Set<Store> stores();                    <---- NEW FUNC
    }

...

The reason we did not expose APIs for topic names directly is that for source nodes, it is possible to have Pattern and for sink nodes, it is possible to have topic-extractors, and hence it's better to let users leveraging on the lower-level APIs to construct the topic names programmatically themselves.


Proposed Changes

In order to fall back to global config values, we will need to leverage on the newly added `StreamsBuilder#build(Properties)`; if the old `StreamsBuilder#build()` is called, then serde information would not be exposed via the description (i.e. they will be null) since it is not yet "determined". Also if the TopologyDescription is from the topology built from `StreamsBuilder#build()`, then its `toString` function would not be augmented as well.

Note that the augmented topology description only contains the serde class name, but it does not necessarily include the inner class name.


Compatibility, Deprecation, and Migration Plan

If there are any applications that depends on parsing the string value for, e.g. visualizing the topology description, then their code needs to be updated accordingly. I think this is okay to break such compatibility without introducing a deprecation phase of it since we are leveraging on the newly added `build()` function.


Rejected Alternatives

None.