You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Gaurav Agarwal <ga...@gmail.com> on 2015/04/09 07:29:05 UTC

delete.retention.ms

I am new to Kafka that's the reason asking so many question

KeyedMessage<String, byte[]> keyedMessage = new KeyedMessage<String,
byte[]>(request.getRequestTopicName(),SerializationUtils.serialize(message));
producer.send(keyedMessage);

Currently,I am sending message without any key maintained as part of keyed
message , will it still work with delete.retention.ms ,Do i need to send
key as part of message? Is this good to make key as part of message.


 There are couple of question on this : First Question , Can we consume the
message on the key basis , Currently i am consuming message from
MessagAndMetadata mm . or is it fine to ignore key at the time of consuming
message.I am using hig Level Consumer Api.

Re: delete.retention.ms

Posted by Madhukar Bharti <bh...@gmail.com>.
Hi Gaurav,

First of all, *delete.retention.ms <http://delete.retention.ms>* tells
Kafka cluster about how long messages should be retained. Producer need not
to do anything with this property, It is broker's configuration or topic
level configuration.

*"Can we consume the message on the key basis"*
Message key is specially used for redirecting the message in particular
partition. You can't consume messages based on key as different keys can
also be redirected to same partition if we applied some custom partitioning
and Kafka by design itself provides in-order delivery.

*"is it fine to ignore key at the time of consuming message"*
Its depends upon your need. If after consuming you want to deal with the
key then use it other wise you can simply ignore the key.


Regards,
Madhukar

On Thu, Apr 9, 2015 at 10:59 AM, Gaurav Agarwal <ga...@gmail.com>
wrote:

> I am new to Kafka that's the reason asking so many question
>
> KeyedMessage<String, byte[]> keyedMessage = new KeyedMessage<String,
>
> byte[]>(request.getRequestTopicName(),SerializationUtils.serialize(message));
> producer.send(keyedMessage);
>
> Currently,I am sending message without any key maintained as part of keyed
> message , will it still work with delete.retention.ms ,Do i need to send
> key as part of message? Is this good to make key as part of message.
>
>
>  There are couple of question on this : First Question , Can we consume the
> message on the key basis , Currently i am consuming message from
> MessagAndMetadata mm . or is it fine to ignore key at the time of consuming
> message.I am using hig Level Consumer Api.
>