Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/4616#discussion_r136279538 --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamSink.java --- @@ -31,14 +31,24 @@ private static final long serialVersionUID = 1L; + private transient SimpleSinkContext sinkContext; + public StreamSink(SinkFunction<IN> sinkFunction) { super(sinkFunction); chainingStrategy = ChainingStrategy.ALWAYS; } @Override + public void open() throws Exception { + super.open(); + + this.sinkContext = new SimpleSinkContext<>(); + } + + @Override public void processElement(StreamRecord<IN> element) throws Exception { - userFunction.invoke(element.getValue()); + sinkContext.element = element; + userFunction.invoke(sinkContext, element.getValue()); --- End diff -- `StreamRecord` is an internal concept that should not be exposed in any user facing API. That's the reason for the extract context. Plus, the context allows us to extend the information that we pass to the `SinkFunction` in the future, similar to the context in `ProcessFunction` and `ProcessWindowFunction`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---