This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void onProcessingTime(long timestamp) throws Exception { | |
| // register next timer | |
| Watermark newWatermark = userFunction.getCurrentWatermark(); | |
| if (newWatermark != null && newWatermark.getTimestamp() > currentWatermark) { | |
| currentWatermark = newWatermark.getTimestamp(); | |
| // emit watermark | |
| output.emitWatermark(newWatermark); | |
| } | |
| long now = getProcessingTimeService().getCurrentProcessingTime(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EventStreamWriter<EventType> writer = clientFactory.createEventWriter(stream, serializer, | |
| EventWriterConfig.builder().automaticallyNoteTime(true).build()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Transaction<EventType> txn = writer.beginTxn(); | |
| //... write events to transaction. | |
| txn.commit(txnTimestamp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EventStreamWriter<EventType> writer = clientFactory.createEventWriter(stream, serializer, | |
| EventWriterConfig.builder().build()); | |
| //... write events ... | |
| writer.noteTime(currentTime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); | |
| env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); |