vvcephei commented on a change in pull request #9361:
URL: https://github.com/apache/kafka/pull/9361#discussion_r498904526
##########
File path:
streams/src/main/java/org/apache/kafka/streams/processor/api/ProcessorContext.java
##########
@@ -55,6 +52,16 @@
*/
TaskId taskId();
+ /**
+ * The metadata of the record, if it is defined. Note that as long as the
processor is
Review comment:
Thanks, @pgwhalen !
I agree, the docs I wrote were a little too terse. How about this:
```java
/**
* The metadata of the source record, if is one. Processors may be
invoked to
* process a source record from an input topic, to run a scheduled
punctuation
* (see {@link ProcessorContext#schedule(Duration, PunctuationType,
Punctuator)} ),
* or because a parent processor called {@link
ProcessorContext#forward(Record)}.
* <p>
* In the case of a punctuation, there is no source record, so this
metadata would be
* undefined. Note that when a punctuator invokes {@link
ProcessorContext#forward(Record)},
* downstream processors will receive the forwarded record as a regular
* {@link Processor#process(Record)} invocation. In other words, it
wouldn't be apparent to
* downstream processors whether or not the record being processed came
from an input topic
* or punctuation and therefore whether or not this metadata is defined.
This is why
* the return type of this method is {@link Optional}.
* <p>
* If there is any possibility of punctuators upstream, any access
* to this field should consider the case of
* "{@code recordMetadata().isPresent() == false}".
* Of course, it would be safest to always guard this condition.
*/
```
----------------------------------------------------------------
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]