Lets say there are two services. One generates event
A and the other event
We need to build a new service that implements the function
C = func(A, B) , which produces the result
B are asynchronous events, they may reach (and invoke) the new service separately.
Depending on what is required, it may be apt for the new service to:
- either wait for both events,
- or implement different variations of the function:
C = func(A,C')or
C = func(B,C')where
C'is the previous state of
C(assuming that it is even possible to build that function)
- or query back to retrieve the complimentary event, e.g. if
Ainvoked the service, then query for
Lets say the requirement is that we update the state of
C ASAP, and
B have a significant time gap in occurrence - that rules out option #1.
Additionally assume it is hard/impossible to build different variations of the function (#2).
That leaves us with option #3, which probably has drawbacks because it may be breaking the event driven paradigm (or maybe not, I am not sure).
How should we solve this problem? I expected this to be a common problem with a recommended pattern, but I could not find it. Any suggestions or pointers on where I could find the answer, or if the question is wrong, how should I look at it?