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 TypeMethodDescriptionbuild()
Build the store as defined by the builder.Returns a Map containing any log configs that will be used when creating the changelog for theStateStore
.boolean
name()
Return the name of this state store builder.Disable caching on the store.Enable caching on the store.Disable the changelog for store built by thisStoreBuilder
.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
StateStore
IfloggingEnabled
returns false, this function will always return an empty map
-
loggingEnabled
boolean loggingEnabled()- Returns:
true
if theStateStore
should 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
-