microsoft / psi

Platform for Situated Intelligence
https://github.com/microsoft/psi/wiki
Other
542 stars 97 forks source link

Is there any Re-order component? #191

Open KanaHayama opened 3 years ago

KanaHayama commented 3 years ago

An operator or component that receive Message<T> which contains out-of-order OriginatingTime, and Post(T, message.OriginatingTime) given a threshold for maximum delay.

(If there isn't, I have to write one with Window operator and a timer.)

sandrist commented 3 years ago

There is no such operator or component. To achieve such a re-order component reproducibly, in principle you would need to wait until the very last message on the stream before posting anything (in case the last message happens to have the earliest originating time), which probably isn't very practical.

As you mentioned, you could probably implement something that works well enough for your specific use case, either as a specific component, or a combination of operators and some state. You would wait for only some specified amount of time (in wall clock time) before posting what you have stored so far in the right order. If you receive subsequent messages with earlier originating times, you would have to either drop them or post with a later originating time.

Feel free to follow up in this thread if you have any trouble writing your component. Would be happy to help get you unstuck.