Package org.apache.kafka.streams.state
Interface StoreBuilder<T extends StateStore>
- Type Parameters:
T- the type of store to build
public interface StoreBuilder<T extends StateStore>
Build a
StateStore wrapped with optional caching and logging.-
Method Summary
Modifier and Type Method Description Tbuild()Build the store as defined by the builder.Map<String,String>logConfig()Returns a Map containing any log configs that will be used when creating the changelog for theStateStore.booleanloggingEnabled()Stringname()Return the name of this state store builder.StoreBuilder<T>withCachingDisabled()Disable caching on the store.StoreBuilder<T>withCachingEnabled()Enable caching on the store.StoreBuilder<T>withLoggingDisabled()Disable the changelog for store built by thisStoreBuilder.StoreBuilder<T>withLoggingEnabled(Map<String,String> config)Maintain a changelog for any changes made to the store.
-
Method Details
-
withCachingEnabled
StoreBuilder<T> withCachingEnabled()Enable caching on the store.- Returns:
- this
-
withCachingDisabled
StoreBuilder<T> withCachingDisabled()Disable caching on the store.- Returns:
- this
-
withLoggingEnabled
Maintain a changelog for any changes made to the store. Use the provided config to set the config of the changelog topic.- Parameters:
config- config applied to the changelog topic- Returns:
- this
-
withLoggingDisabled
StoreBuilder<T> withLoggingDisabled()Disable the changelog for store built by thisStoreBuilder. This will turn off fault-tolerance for your store. By default the changelog is enabled.- Returns:
- this
-
build
T build()Build the store as defined by the builder.- Returns:
- the built
StateStore
-
logConfig
Returns a Map containing any log configs that will be used when creating the changelog for theStateStore.Note: any unrecognized configs will be ignored by the Kafka brokers.
- Returns:
- Map containing any log configs to be used when creating the changelog for the
StateStoreIfloggingEnabledreturns false, this function will always return an empty map
-
loggingEnabled
boolean loggingEnabled()- Returns:
trueif theStateStoreshould have logging enabled
-
name
String name()Return the name of this state store builder. This must be a valid Kafka topic name; valid characters are ASCII alphanumerics, '.', '_' and '-'.- Returns:
- the name of this state store builder
-