KafkaStream时间戳问题CreateTime = -1引起的程序中断
Exception in thread “app-8835188a-e0a0-46da-ac2a-6820ec197628-StreamThread-1” org.apache.kafka.streams.errors.StreamsException: Input record ConsumerRecord(topic = raw_103, partition = 1, offset = 7032668, CreateTime = -1, serialized key size = -1, serialized value size = 111, headers = RecordHeaders(headers = [], isReadOnly = false), key = null, value = { “key1”: [ 103, “4113471085724846255”, “–”, “2018-04-17 21:33:53” ], “key2”: [ [ 213309, “–”, 20128, 1 ] ] }) has invalid (negative) timestamp. Possibly because a pre-0.10 producer client was used to write this record to Kafka without embedding a timestamp, or because the input topic was created before upgrading the Kafka cluster to 0.10+. Use a different TimestampExtractor to process this data.
Exception in thread "app-8835188a-e0a0-46da-ac2a-6820ec197628-StreamThread-1" org.apache.kafka.streams.errors.StreamsException: Input record ConsumerRecord(topic = raw_103, partition = 1, offset = 7032668, CreateTime = -1, serialized key size = -1, serialized value size = 111, headers = RecordHeaders(headers = [], isReadOnly = false

博客内容讲述了在使用KafkaStream时遇到的CreateTime为-1的时间戳异常,导致程序中断的问题。异常信息指出可能是因为使用了预0.10版本的生产者客户端写入记录,或者输入主题是在升级到0.10+之前创建的。解决方案是通过创建自定义的时间戳提取类MyEventTimeExtractor,返回0作为默认时间戳,并在配置中添加相关设置,从而成功解决问题。
1414

被折叠的 条评论
为什么被折叠?



