Github user pnowojski commented on a diff in the pull request: https://github.com/apache/flink/pull/4616#discussion_r136334346 --- 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 -- I get it, however I still do not like this objects repacking thing done here. Instead of passing `StreamRecord` directly, we could introduce `UserRecord` interface with `getTimestamp()` method, that would be implemented by `StreamRecord`. But that's minor complain, if you have stronger preferences for keeping it as it is, it's fine for me.
--- 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. ---