Is Kafka timestamp order corresponding to the offset?

你离开我真会死。 提交于 2020-08-08 04:04:05

问题


We use kafka for our message queue,Our business required that message timestamp must with the same order with the offset, that means: if there are message m1 and message m2, and (m1.timestamp

回答1:


It depends on the timestamp type used, there are two types:

  • CreateTime - timestamp is assigned when producer record is created, so before sending. There can be retries, so there is no guarantee that ordering is preserved.
  • LogAppendTime - timestamp is assigned when record is appended to the log on the broker. In that case ordering per partition is preserved. Multiple messages might get the same timestamp assigned.

By default, CreateTime is used. To change this, set log.message.timestamp.type for broker or message.timestamp.type for particular topic.



来源:https://stackoverflow.com/questions/55258690/is-kafka-timestamp-order-corresponding-to-the-offset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!