I have a stream of GPS coordinates from different devices. Those coordinates could arrive out of order but they all have an event time. I want to calculate the total distance from GPS coordinates.
From Beam Programming Guide:
The combining function should be commutative and associative, as the function is not necessarily invoked exactly once on all values with a given key
Input:
driver_id,x,y,event_time,processing_time
1,1,1,100001,20001
1,5,5,100004,20002
1,4,5,100003,20003
Expected output:
driver_id, distance, event_time
1,3,100001
1,1,100003
Since the order is important I cannot use anything like CombineFn.
So my question is:
- How can I calculate distance using Apache beam with respect to the late incoming of events?
- What can I do about successive coordinates that sit in two different windows?
- Are there any other alternative stream processing frameworks that can solve my problem?
- Events may deliver two days after event time, but I want to have a approximate results before making sure that they all delivered.