[
https://issues.apache.org/jira/browse/KAFKA-12812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Guozhang Wang updated KAFKA-12812:
----------------------------------
Labels: new-streams-runtime-should-fix (was: )
> Consider refactoring state store registration path
> --------------------------------------------------
>
> Key: KAFKA-12812
> URL: https://issues.apache.org/jira/browse/KAFKA-12812
> Project: Kafka
> Issue Type: Improvement
> Components: streams
> Reporter: Guozhang Wang
> Priority: Major
> Labels: new-streams-runtime-should-fix
>
> Today our state store registration call path within the stateManager (both
> local and global) is like this:
> {code}
> for each store: store.init(store, context)
> -> context.register(root, callback)
> -> stateManager.registerStore(store, callback)
> {code}
> One can see that, we have an awkward loop from stateManager back to
> stateManager, and we require users to not forget calling
> context.register(root, callback). We do this only in order to let users pass
> the customized callback implementation to the stateManager.
> What about a different path like this:
> 1) We add a new interface in StateStore, like `StateRestoreCallback
> getCallback()` that each impl class need to provide.
> 2) We remove the `context.register(root, callback)` call; and because of
> that, we do not need to pass in `root` in the store.init as well.
> 3) stateManager just call `store.init(context)` (without the first
> parameter), and then put the store along with its restore callback into the
> map, without the separate `registerStore` function.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)