I am using kafka 0.7. and I write a simple customized partitioner:

public static class ExpertSearchCollectionPartitioner
implementsPartitioner<Long> {

    @Override

    public synchronized int partition(Long key, int numPartitions) {

      System.out.print("    partition: " + key.hashCode() + ", " +
numPartitions + ", " + (key.hashCode() % numPartitions) + "\n");

      return (int) (key.hashCode() % (long)numPartitions);

    }

  }


I got a weird problem. When I ran the producer, for the first one or two
message, the numPartitions is always 1. however, after that,

it starts to get the value (96, which I config in server.property)


anyone has any clue? hint? suggestions?


Thanks!

Reply via email to