I read data from four Kinesis streams. The data in each stream is a different data type. After reading all four streams in, I assign timestamps and watermarks, and aggregate the data from each stream. The results of the four aggregations are all output using the same generic object. I want to union the results from the four streams so I can send the unioned stream to one ProcessFunction. This essentially would allow me to use the ProcessFunction like a CoProcessFunction, but I would be able to deal with data from more than two streams (in this case the ProcessFunction would receive the aggregations from all four individual streams).
However, my concern is that this might not play well with watermarks. If one stream is taking longer to process or is somehow behind, its aggregation might not make it to the process function if all the watermarks are passed forward in the union and one of the streams is ahead of the others. If that is the case, then the process function's watermark would be the max of the watermarks it sees from the four individual streams.
My question is this: How do watermarks get handled in union operators and how do operators downstream of the union process those watermarks?
Additionally: If the union of generic objects does not work due to watermark issues, what is the best way to combine the results of four different aggregations when Flink only supports a CoProcessFunction for two streams?