Re: key used by producer

2013-05-13 Thread Jun Rao
Note that the key is provided by the application. Kafka itself makes no effort to make sure messages are in key order. Thanks, Jun On Mon, May 13, 2013 at 8:34 AM, Yu, Libo wrote: > Thanks for both of you. The key is actually very useful. If the key > increases > monotonically, it can be used

Re: key used by producer

2013-05-13 Thread Yu, Libo
Thanks for both of you. The key is actually very useful. If the key increases monotonically, it can be used as the version of the message. Say version 1 is sent first followed by version 2. It is possible that version 2 is received first by the consumer. When version 1 is received, it will be igno

Re: key used by producer

2013-05-09 Thread David Arthur
Yes, I'm pretty sure keys are now retained with the message and returned in the consumer. In the Java/Scala client, ConsumerIterator returns a MessageAndMetadata which includes key, message, topic, partition, and offset -David On 5/9/13 10:44 AM, Yu, Libo wrote: Hi, I am looking at the exa

Re: key used by producer

2013-05-09 Thread Jun Rao
Yes, our consumer iterator returns MessageAndMetadata. You can do consumerIterator.next().key() to get the key. Thanks, Jun On Thu, May 9, 2013 at 7:44 AM, Yu, Libo wrote: > Hi, > > I am looking at the example producer code for kafka 0.8. > I notice it is possible to specify a key when creati

key used by producer

2013-05-09 Thread Yu, Libo
Hi, I am looking at the example producer code for kafka 0.8. I notice it is possible to specify a key when creating KeyedMessage. This key will be used for assigning the message to some partition. I wonder if the key will be received by the consumer. Thanks. Libo