对于0.10.0 kafka producer,分区的负数也会被拒绝。
检查没有完成
ProducerRecord
就像在最近的版本中,但是
KafkaProducer.partition()
您将得到以下堆栈跟踪:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid partition given with record: -1 is not in the range [0...0].
at org.apache.kafka.clients.producer.KafkaProducer.partition(KafkaProducer.java:717)
at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:459)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:430)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:353)