cameronlee314 commented on a change in pull request #947: SAMZA-2120: Enable 
custom handling of ConsumerRecords consumed by Kafka
URL: https://github.com/apache/samza/pull/947#discussion_r264485463
 
 

 ##########
 File path: 
samza-kafka/src/main/scala/org/apache/samza/system/kafka/KafkaConsumerProxy.java
 ##########
 @@ -328,7 +325,28 @@ private void fetchMessages() {
     return results;
   }
 
-  private int getRecordSize(ConsumerRecord<K, V> r) {
+  /**
+   * Convert a {@link ConsumerRecord} to an {@link IncomingMessageEnvelope}. 
This may also execute some other custom
+   * logic for each new {@link IncomingMessageEnvelope}.
+   *
+   * This has a protected visibility so that {@link KafkaConsumerProxy} can be 
extended to add special handling logic
+   * for custom Kafka systems.
+   *
+   * @param consumerRecord {@link ConsumerRecord} from Kafka that was consumed
+   * @param systemStreamPartition {@link SystemStreamPartition} corresponding 
to the record
+   * @return {@link IncomingMessageEnvelope} corresponding to the {@code 
consumerRecord}
+   */
+  protected IncomingMessageEnvelope handleNewRecord(ConsumerRecord<K, V> 
consumerRecord,
+      SystemStreamPartition systemStreamPartition) {
+    return new IncomingMessageEnvelope(systemStreamPartition, 
String.valueOf(consumerRecord.offset()),
 
 Review comment:
   Yes

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to