Guozhang Wang created KAFKA-12812: ------------------------------------- Summary: Consider refactoring state store registration path Key: KAFKA-12812 URL: https://issues.apache.org/jira/browse/KAFKA-12812 Project: Kafka Issue Type: Bug Components: streams Reporter: Guozhang Wang
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.3.4#803005)