Skip to content

Commit

Permalink
async_producer: clarify ProducerMessage Timestamp doc
Browse files Browse the repository at this point in the history
The `Timestamp` field was introduced in
IBM#678 and at this point was only set by
the broker.

Subsequent to this, the changes described in [KIP-32] were implemented,
allowing the `Timestamp` of the message to be set by a producer when the
broker was configured to use `CreateTime`.

This commit updates the doc on the ProducerMessage struct to reflect that
depending on which of the `CreateTime` and `LogAppendTime` modes are active,
the `Timestamp` can be meaningfully set by either the request or the
response.

[KIP-32]: https://cwiki.apache.org/confluence/display/KAFKA/KIP-32+-+Add+timestamps+to+Kafka+message
  • Loading branch information
kjgorman committed May 2, 2019
1 parent ea9ab1c commit f0a3a2f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions async_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,16 @@ type ProducerMessage struct {
// Partition is the partition that the message was sent to. This is only
// guaranteed to be defined if the message was successfully delivered.
Partition int32
// Timestamp is the timestamp assigned to the message by the broker. This
// is only guaranteed to be defined if the message was successfully
// delivered, RequiredAcks is not NoResponse, and the Kafka broker is at
// least version 0.10.0.
// Timestamp can be one of CreateTime or LogAppendTime (configured at the broker,
// default value CreateTime) when the broker version is at least 0.10.0.
//
// When configured to CreateTime, the timestamp is specified by the producer
// either by explicitly setting this field, or when the message is added
// to a produce set.
//
// When configured to LogAppendTime, the timestamp assigned to the message
// by the broker. This is only guaranteed to be defined if the message was
// successfully delivered and RequiredAcks is not NoResponse.
Timestamp time.Time

retries int
Expand Down

0 comments on commit f0a3a2f

Please sign in to comment.