mjsax commented on a change in pull request #10810:
URL: https://github.com/apache/kafka/pull/10810#discussion_r647695386



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/RecordContext.java
##########
@@ -17,39 +17,94 @@
 package org.apache.kafka.streams.processor;
 
 import org.apache.kafka.common.header.Headers;
+import org.apache.kafka.streams.kstream.ValueTransformerWithKeySupplier;
 
 /**
  * The context associated with the current record being processed by
  * an {@link Processor}
  */
 public interface RecordContext {
+
     /**
-     * @return  The offset of the original record received from Kafka;
-     *          could be -1 if it is not available
+     * Returns the topic name of the current input record; could be {@code 
null} if it is not
+     * available.
+     *
+     * <p> For example, if this method is invoked within a {@link 
Punctuator#punctuate(long)
+     * punctuation callback}, or while processing a record that was forwarded 
by a punctuation
+     * callback, the record won't have an associated topic.
+     * Another example is
+     * {@link 
org.apache.kafka.streams.kstream.KTable#transformValues(ValueTransformerWithKeySupplier,
 String...)}
+     * (and siblings), that do not always guarantee to provide a valid topic 
name, as they might be
+     * executed "out-of-band" due to some internal optimizations applied by 
the Kafka Streams DSL.
+     *
+     * @return the topic name
      */
-    long offset();
+    String topic();
 
     /**
-     * @return  The timestamp extracted from the record received from Kafka;
-     *          could be -1 if it is not available
+     * Returns the partition id of the current input record; could be {@code 
-1} if it is not
+     * available.
+     *
+     * <p> For example, if this method is invoked within a {@link 
Punctuator#punctuate(long)
+     * punctuation callback}, or while processing a record that was forwarded 
by a punctuation
+     * callback, the record won't have an associated partition id.
+     * Another example is
+     * {@link 
org.apache.kafka.streams.kstream.KTable#transformValues(ValueTransformerWithKeySupplier,
 String...)}
+     * (and siblings), that do not always guarantee to provide a valid 
partition id, as they might be
+     * executed "out-of-band" due to some internal optimizations applied by 
the Kafka Streams DSL.
+     *
+     * @return the partition id
      */
-    long timestamp();
+    int partition();
 
     /**
-     * @return  The topic the record was received on;
-     *          could be null if it is not available
+     * Returns the offset of the current input record; could be {@code -1} if 
it is not
+     * available.
+     *
+     * <p> For example, if this method is invoked within a {@link 
Punctuator#punctuate(long)
+     * punctuation callback}, or while processing a record that was forwarded 
by a punctuation
+     * callback, the record won't have an associated offset.
+     * Another example is
+     * {@link 
org.apache.kafka.streams.kstream.KTable#transformValues(ValueTransformerWithKeySupplier,
 String...)}
+     * (and siblings), that do not always guarantee to provide a valid offset, 
as they might be
+     * executed "out-of-band" due to some internal optimizations applied by 
the Kafka Streams DSL.
+     *
+     * @return the offset
      */
-    String topic();
+    long offset();
 
     /**
-     * @return  The partition the record was received on;
-     *          could be -1 if it is not available
+     * Returns the current timestamp.
+     *
+     * <p> If it is triggered while processing a record streamed from the 
source processor,
+     * timestamp is defined as the timestamp of the current input record; the 
timestamp is extracted from
+     * {@link org.apache.kafka.clients.consumer.ConsumerRecord ConsumerRecord} 
by {@link TimestampExtractor}.

Review comment:
       Yes. Otherwise it renders 
`org.apache.kafka.clients.consumer.ConsumerRecord` but we only want to have the 
short `ConsumerRecord`




-- 
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


Reply via email to