[ 
https://issues.apache.org/jira/browse/GOBBLIN-820?focusedWorklogId=273712&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-273712
 ]

ASF GitHub Bot logged work on GOBBLIN-820:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Jul/19 05:49
            Start Date: 09/Jul/19 05:49
    Worklog Time Spent: 10m 
      Work Description: htran1 commented on pull request #2682: [GOBBLIN-820] 
Add keyed write capability to Kafka writer
URL: https://github.com/apache/incubator-gobblin/pull/2682#discussion_r301404509
 
 

 ##########
 File path: 
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/kafka/writer/KafkaWriterHelper.java
 ##########
 @@ -90,4 +94,32 @@ public static Object getKafkaProducer(Properties props) {
       throw Throwables.propagate(e);
     }
   }
+
+  public static <K, D> K getKey(D record, KafkaWriterCommonConfig commonConfig)
+      throws FieldMappingException {
+    if (commonConfig.isKeyed()) {
+      return (K) commonConfig.getTypeMapper().getField(record, 
commonConfig.getKeyField());
+    } else {
+      return null;
+    }
+  }
+
+  public static <D> D getValue(D record, KafkaWriterCommonConfig commonConfig)
+      throws FieldMappingException {
+    return (D) commonConfig.getTypeMapper().getField(record, 
commonConfig.getValueField());
+  }
+
+  public static <V, K> Pair<K,V> getKeyValuePair(V record, 
KafkaWriterCommonConfig commonConfig)
+      throws FieldMappingException {
+    K key = null;
+    TypeMapper typeMapper = commonConfig.getTypeMapper();
 
 Review comment:
   Why not call `getKey` and `getValue` to avoid code duplication? Is this to 
be a little more efficient?
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 273712)
    Time Spent: 20m  (was: 10m)

> Support keyed writer for Kafka
> ------------------------------
>
>                 Key: GOBBLIN-820
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-820
>             Project: Apache Gobblin
>          Issue Type: Improvement
>          Components: gobblin-kafka
>            Reporter: Shirshanka Das
>            Assignee: Shirshanka Das
>            Priority: Major
>              Labels: kafka
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The current Kafka writer uses the non-keyed API to produce to Kafka. 
> This issue proposes to add support for keyed writes to Kafka. 
> Constraints:
>  * Minimal changes needed to existing pipeline configuration to add support 
> for keyed writes to Kafka
>  * Minimal changes to gobblin-core. Do not add general support for 
> keyed-writers as part of this issue. 
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to