返回到文章

采纳

编辑于

kafka消息格式

消息格式
history
kafka_history


5.4 消息格式

/** 
     * A message. The format of an N byte message is the following: 
     * 
     * If magic byte is 0 
     * 
     * 1. 1 byte "magic" identifier to allow format changes 
     * 
     * 2. 4 byte CRC32 of the payload 
     * 
     * 3. N - 5 byte payload 
     * 
     * If magic byte is 1 
     * 
     * 1. 1 byte "magic" identifier to allow format changes 
     * 
     * 2. 1 byte "attributes" identifier to allow annotations on the message independent of the version (e.g. compression enabled, type of codec used) 
     * 
     * 3. 4 byte CRC32 of the payload 
     * 
     * 4. N - 6 byte payload 
     * 
     */