Kafka Streams 关闭处理器的状态存储
Kafka Streams closing processor's state store
Kafka 1.0.1 中 Processor.close() 的 JavaDoc 描述说:
Note: Do not close any streams managed resources, like StateStores
here, as they are managed by the library.
此外,StateStore.close() 的 JavaDoc 描述说:
Users only need to implement this function but should NEVER need to call this api explicitly as it will be called by the library automatically when necessary
但我在 documentation 中找到了一个示例,其中状态存储在该方法中被显式关闭:
@Override
public void close() {
// close the key-value store
kvStore.close();
}
所以,我有点迷路了。我应该关闭 Processor
内的国营商店吗?
不,你不应该关闭商店。
示例代码片段是错误的。感谢您指出。我打开了一个 PR 来修复它:https://github.com/apache/kafka/pull/4667
Kafka 1.0.1 中 Processor.close() 的 JavaDoc 描述说:
Note: Do not close any streams managed resources, like StateStores here, as they are managed by the library.
此外,StateStore.close() 的 JavaDoc 描述说:
Users only need to implement this function but should NEVER need to call this api explicitly as it will be called by the library automatically when necessary
但我在 documentation 中找到了一个示例,其中状态存储在该方法中被显式关闭:
@Override
public void close() {
// close the key-value store
kvStore.close();
}
所以,我有点迷路了。我应该关闭 Processor
内的国营商店吗?
不,你不应该关闭商店。
示例代码片段是错误的。感谢您指出。我打开了一个 PR 来修复它:https://github.com/apache/kafka/pull/4667