Most of the properties of the send response are not populated until after the message is sent and the message broker acknowledges receipt of a message. The message broker sends a receipt asynchronously which indicates either success or failure to store the message. When the message receipt is received from the broker, the remaining send response properties are populated. The values of the properties depend on success or failure as well as the record that was sent. Note that in some cases, such as when the client cannot contact the Apache® Kafka® cluster, the client library provides the error message and error code values after all redelivery attempts have failed.

This table shows when the send response property values are populated and the default values in each case. Initially, only the Completed, Topic, and Producer properties are set right after Send() is called.

Property Default value (before delivery receipt received) Value on success (after delivery receipt received) Value after failure (after delivery receipt received)
Completed FALSE TRUE TRUE
Success ? TRUE FALSE
PartitionId ? a non-negative integer ?
Offset ? a non-negative integer ?
Timestamp ? timestamp of the record (any valid INT64) ?
ErrorMessage ? ? A character value indicating the underlying problem of why the record was not successfully sent.
ErrorCode ? ? Any valid integer. May be a negative, 0, or a positive integer. The exact value depends on the underlying implementation.
Producer <the producer that sent the message> <the producer that sent the message> <the producer that sent the message>
Topic <the assigned topic of the producer record> <the assigned topic of the producer record> <the assigned topic of the producer record>