The issue
I am building a server-side system that handles streams of time-series events from multiple users and I'd like to perform an action after a certain quiet period has elapsed in the event stream of every user.
For example, a user emits this stream of data:
-[5]------[4]-[3]--[2][1]-->
My consumer will handle this stream of data, but will also perform an operation if X time has passed after [4]
and before [5]
.
Rx?
When looking at the issue Rx debounce immediately comes to mind.
Rx + Multiple consumers?
But is Rx fit for an environment where I run more than one consumer for the streams?
To my understanding, multiple consumers means that individual consumers potentially may be exposed only to parts of the time-series, making it impossible to know when a specific user's stream has started or ended.
For example:
USER | Application
|
-[5]------[4]-[3]--[2][1]--> | ---> [4]--[2]-[1] ---> CONSUMER 1
| \
| \-> [5]------[3] ---> CONSUMER 2
So can I handle streams with more than one consumer but still harness the power or Rx and debounce? Is there a more fitting solution for this issue?
-[5]------[4]-[3]--[2][1]-
and you are wondering if you can debounce that observable? Because of course you can...