Re: Producer code to a partition

2016-02-03 Thread Manikumar Reddy
In kafka, each record can have a key. This key is used to distribute records to partitions. All non-keyed records will be distributed in round-robin fashion. All keyed records will be distributed based on the hash of the key / or can write a custom partitioner. or we can specify partition number f

Re: Producer code to a partition

2016-02-03 Thread Joe San
What is the partition key? Why do I need to specify the partition key and a partition number? On Thu, Feb 4, 2016 at 7:17 AM, Manikumar Reddy wrote: > Hi, > > You can use ProducerRecord(java.lang.String topic, java.lang.Integer > partition, K key, V value) constructor > to pass partition numb

Re: Producer code to a partition

2016-02-03 Thread Manikumar Reddy
Hi, You can use ProducerRecord(java.lang.String topic, java.lang.Integer partition, K key, V value) constructor to pass partition number. https://kafka.apache.org/090/javadoc/org/apache/kafka/clients/producer/ProducerRecord.html Kumar On Thu, Feb 4, 2016 at 11:41 AM, Joe San wrote: > Kafk

Producer code to a partition

2016-02-03 Thread Joe San
Kafka users, The code below is something that I have to write to a Topic! def publishMessage(tsDataPoints: Seq[DataPoint]): Future[Unit] = { Future { logger.info(s"Persisting ${tsDataPoints.length} data-points in Kafka topic ${producerConfig.topic}") val dataPoints = DataPoints("kafkaPr