You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/02/01 17:54:15 UTC

[GitHub] merlimat commented on a change in pull request #3462: Added suppport for Kafka partitioner and explicit setting of partition on record

merlimat commented on a change in pull request #3462: Added suppport for Kafka partitioner and explicit setting of partition on record
URL: https://github.com/apache/pulsar/pull/3462#discussion_r253141658
 
 

 ##########
 File path: pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/producer/PulsarKafkaProducer.java
 ##########
 @@ -232,12 +243,11 @@ public void close(long timeout, TimeUnit unit) {
     }
 
     private int buildMessage(TypedMessageBuilder<byte[]> builder, ProducerRecord<K, V> record) {
-        if (record.partition() != null) {
-            throw new UnsupportedOperationException("");
-        }
-
+        byte[] keyBytes = null;
         if (record.key() != null) {
-            builder.key(getKey(record.topic(), record.key()));
+            String key = getKey(record.topic(), record.key());
+            keyBytes = key.getBytes();
 
 Review comment:
   Fixed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services