Kafka Streams 上的保留 > 2.10
Retention on Kafka Streams > 2.10
我正在加入 KStreams,因此我需要设置 JoinWindows。连接的数据已从 CustomTimestampExtractors 计算出时间戳。数据可能乱序。我可以使用已弃用的 JoinWindows.until(long)
方法设置 retention,但由于已弃用,我正在寻找另一种解决方案。
我找到了 windowstore.changelog.additional.retention.ms-属性 我应该使用它吗?这将导致所有状态存储保留那么久。
如文档所述:
Use JoinWindows#grace(Duration) instead
恕我直言,相比之下,文档有点误导 to:
Set the window maintain duration (retention time) in milliseconds. This retention time is a guaranteed lower bound for how long a window will be maintained.
但请注意,我希望我的 StateStore 保留尽可能长的时间,因此我之前使用的是 JoinWindows.until(Long.MAX_VALUE)
。使用 JoinWindows.grace(Duration.ofMillis(Long.Max_VALUE))
确实会抱怨 grace period 不能为负数。你必须使用较小的值。
我正在加入 KStreams,因此我需要设置 JoinWindows。连接的数据已从 CustomTimestampExtractors 计算出时间戳。数据可能乱序。我可以使用已弃用的 JoinWindows.until(long)
方法设置 retention,但由于已弃用,我正在寻找另一种解决方案。
我找到了 windowstore.changelog.additional.retention.ms-属性 我应该使用它吗?这将导致所有状态存储保留那么久。
如文档所述:
Use JoinWindows#grace(Duration) instead
恕我直言,相比之下,文档有点误导 to:
Set the window maintain duration (retention time) in milliseconds. This retention time is a guaranteed lower bound for how long a window will be maintained.
但请注意,我希望我的 StateStore 保留尽可能长的时间,因此我之前使用的是 JoinWindows.until(Long.MAX_VALUE)
。使用 JoinWindows.grace(Duration.ofMillis(Long.Max_VALUE))
确实会抱怨 grace period 不能为负数。你必须使用较小的值。