You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Ewen Cheslack-Postava <ew...@confluent.io> on 2017/04/19 02:42:20 UTC

Re: even if i pass key no change in partition

Do you have more than 1 partition? You may have an auto-created topic with
only 1 partition, in which case the partition of messages will *always* be
the same, regardless of key.

-Ewen

On Fri, Mar 24, 2017 at 5:52 AM, Laxmi Narayan <ni...@gmail.com> wrote:

> Hi,
>
> I am passing key in producer but still no change in partition.
>
>
> I can see in producer response key value but no change in partition.
>
> *This is how my props looks:*
>
> props.put("bootstrap.servers",          "localhost:9092");
> props.put("group.id",                   "test");
> props.put("enable.auto.commit",         "true");
> props.put("auto.commit.interval.ms",    "1000");
> props.put("session.timeout.ms",         "30000");
> props.put("linger.ms",                  "1");
> props.put("key.deserializer",
> "org.apache.kafka.common.serialization.StringDeserializer");
> props.put("value.deserializer",
> "org.apache.kafka.common.serialization.StringDeserializer");
> props.put("key.serializer",
> "org.apache.kafka.common.serialization.StringSerializer");
> props.put("value.serializer",
> "org.apache.kafka.common.serialization.StringSerializer");
> props.put("partitioner.class",
> "org.apache.kafka.clients.producer.internals.DefaultPartitioner");
>
>
>
> *This is my output : *
> ConsumerRecord(topic = test, partition = 0, offset = 449, CreateTime =
> 1490359767112, checksum = 1987036294, serialized key size = 3, serialized
> value size = 16, key = 172, value = hello world - 86)
>
>
>
>
>
> *Regards,*
> *Laxmi Narayan Patel*
> *MCA NIT Durgapur (2011-2014)*
> *Mob:-    9741292048,8345847473    *
>