Lauri Suurväli
03/05/2025, 2:44 PMSingleOutputStreamOperator<Event> processedEvents = someStream.process(processFunction);
processedEvents.sinkTo(firstSink);
processedEvents.sinkTo(secondSink);
Now while in the code it looks like the processed events are first sinked to firstSink and then to secondSink , then I understand there is actually no ordering guarantee here. both of the sinks operate on the same processedEvents stream then they can operate in parallel. A message can appear in secondSink first and then later in firstSink . In case of failures it's also possible that the event reaches secondSink but never reaches the firstSink etc.
My question is: is there a way to force ordering here so that events are always sinked to firstSink first and only after the event is successfully sinked to the firstSink it would be sinked to secondSink.Lauri Suurväli
03/05/2025, 6:54 PMprocessedEvents.sinkTo(firstSink);
SingleOutputStreamOperator<Event> confirmedEvents = processedEvents.map(event -> {
// Ensures firstSink is completed before proceeding
return event;
});
confirmedEvents.sinkTo(secondSink);
Basically the map after the first sink ensures that both the first sink and map need to complete before we can move on to the second sink. Does this work?Lauri Suurväli
03/05/2025, 7:10 PMPedro Mázala
03/06/2025, 10:56 PMLauri Suurväli
03/07/2025, 7:53 AMLauri Suurväli
03/07/2025, 7:55 AMPedro Mázala
03/07/2025, 8:44 AM