The key is used by the client to decide which partition to send the
message to. By the time the client is creating the produce request, it
should be known which partition each message is being sent to. I believe
Neha described the behavior of the Java client which sends messages with
a null key to any partition.
The key is described in past tense because of the use case for
persisting keys with messages. The key is persisted through the broker
so that a consumer knows what key was used to partition the message on
the producer side.
I don't believe that you can have the broker decide which partition a
message goes to.
On 05/21/2013 11:48 AM, Dave Peterson wrote: