Versions Compared

Key

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

...

Code Block
languagejava
titleStreamJoined
public class StreamJoined<K, V1, V2> implements NamedOperation<StreamJoined<K, V1, V2>> {

public static <K, V1, V2> StreamJoined<K, V1, V2> as(final WindowBytesStoreSupplier storeSupplier,
                                                     final WindowBytesStoreSupplier otherSupplier){}

public static <K, V1, V2> StreamJoined<K, V1, V2> as(final String storeName) {}

public static <K, V1, V2> StreamJoined<K, V1, V2> with(final Serde<K> keySerde,
                                                       final Serde<V1> valueSerde,
                                                       final Serde<V2> otherValueSerde) {}
 // The withName method will name the process and provide the base name 
 // for any repartition topics if required

 public StreamJoined<K, V1, V2> withName(final String name) {}

 // The withStoreName is used as the base name for stores provided by Kafka Streams
 // If users provide state store suppliers, then the name in the store supplier is used
 public StreamJoined<K, V1, V2> withStoreName(final String storeName) {}

 public StreamJoined<K, V1, V2> withKeySerde(final Serde<K> keySerde) {}

 public StreamJoined<K, V1, V2> withValueSerde(final Serde<V1> valueSerde) {}

 public StreamJoined<K, V1, V2> withOtherValueSerde(final Serde<V2> otherValueSerde) {}

 public StreamJoined<K, V1, V2> withStoreSupplier(final WindowBytesStoreSupplier storeSupplier) {}

 public StreamJoined<K, V1, V2> withOtherStoreSupplier(final WindowBytesStoreSupplier otherStoreSupplier) {}

 public StreamJoined<K, V1, V2> withLogging(final boolean loggingEnabled) {}

 public StreamJoined<K, V1, V2> withCaching(final boolean cachingEnabled) {}

 public StreamJoined<K, V1, V2> withTopicConfig(final Map<String, String> topicConfig) {}

 public StreamJoined<K, V1, V2> withRetention(final Duration retention) throws IllegalArgumentException {}


Proposed Changes

With this in mind, this KIP aims to add a new configuration object StreamJoined. The StreamJoined configuration allows users to specify Serdes for the join, naming of join processor, the base name of the default state stores, provide store suppliers.  Essentially a merging of Joined and Materialized configuration objects.  We'll add overloaded KStream#join method accepting a StreamJoined parameter without a Joined parameter. The overloads will apply to all flavors of KStream#join (join, left, and outer).  Due to the significant overlap of the new StreamJoined configuration, we'll also deprecate the Joined configuration object and methods using Joined as well.

...

  • Users can provide 0, 1 or 2 StoreSupplier instances.
    • The provided StoreSupplier instances must implement WindowBytesStoreSupplier.
    • In the case of providing zero StoreSupplier(s), KafkaStreams will create two persistent state stores as it does now.  The names for the stores will be auto-generated unless the user gives a name with the StreamJoined#withName method. 
    • In the case of providing one StoreSuppliers, KafkaStreams will create one persistent state store, and the StoreSupplier will create one state store. The name for the default store will be auto-generated unless the user gives a name with the StreamJoined#withName method. 
    • When providing two StoreSuppliers, the state stores for the join will come from the suppliers, and the names will come from the name given to the supplier.
  • There will be a runtime check to ensure that the values of JoinWindows match those of the provided StoreSuppliers.
  • The name of the StoreSupplier will take priority over the name given via StreamJoined#withStoreName.When using any store configuration methods (disabling logging, caching, topic configurations), KafkaStreams will apply these changes to both stores. While this may seem strict, since both stores are participating in the join, it would seem prudent to have both stores configured the same way.

Compatibility, Deprecation, and Migration Plan

...

  • For users that have not named the Join repartition node, then there are no migration concerns.
  • For users that previously have named the Join repartition node and want to upgrade to 2.4, a rolling restart should be possible since the store name will not change.
  • Users electing to add a name to the state store will need to stop all instances and redeploy the new code. Then reset the application before starting to ensure no data is unprocessed.
  • We'll deprecate the Joined config and Stream-Stream join methods using Joined object.  These items will be removed in a later major release.

...