-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Off-chain] Implement merge
observable operator
#280
Comments
"Merge" is what this operator is usually called. See the reactivex docs about it. |
observable
multiplexingobservable
merging
@bryanchriswhite When we started the observable package, we discussed how it resembles a The growing complexity of the observable package is making me think that it's looking more and more like a pubsub (i.e. multiple sources publish to a shared channel and you subscribe on specific events). I wanted to ask you if you're confident that we're still on the right path implementing this ourselves rather than swapping it out for another solution (e.g. nats). |
@Olshansk Id say its more like we are subscribing to differernt events and publishing them to a single notifee. I know this makes little difference but I'm in favour of doing a little research spike before implementing this with @bryanchriswhite as to whether we have outgrown our original ideas for this repo. |
@Olshansk I firmly disagree with this characterization. I think the similarity you're describing is surface-level only. There is no subscribing to specific events; rather, a consumer subscribes to an entire observable for the purpose of handling asynchronous data streams. Observables are not intrinsically related to message-oriented-middleware, which is what I believe you're describing (and NATS is an example of).
I am still very confident that this is the optimal path with respect to readability, maintainability, and extensibility. While observables are fairly abstract, their power simplifies the implementation of other high-level objects; thus encapsulating the complexity of handling asynchronous data streams within observables and operators. Additionally, the observer pattern is well understood and wide-spread across many programming language ecosystems (reactivex as one example specification with many language implementations). Nothing we build in this library should surprise anyone who is familiar with these concepts. I asked chatGPT for help in articulating the differences between observables and pubsub and these are the bits that seemed especially relevant to this discussion:
|
I did another round of searching and these are the only options I could find (which seemed they could potentially be production-grade):
I discovered this blog post discussing the differences between using an observer pattern vs. vanilla channel in go. The conclusion summarizes it nicely:
In our case we get the benefit of both as we're implementing observer pattern interfaces using data structures that lightly wrap go channels. |
@bryanchriswhite I really appreciate you continuing to push and providing all of the following:
My personal summary/takeaway is:
If anything, this gives me more confidence that (eventually) breaking out the Observer package into a separate library will be a real public good. |
observable
mergingmerge
observable operator
@bryanchriswhite Is this something we still need? |
Objective
Implement the ability for two observables to be merged into a single observable that can supply events from two+ sources to a single observer.
Origin Document
#239 realised the need for the ability to subscribe to multiple sources as a necessary refactor for an overly verbose
DelegationClient
subscription strategyGoals
EventsQueryClient
to support merged observablesDeliverables
EventsQueryClient
to allow for multiple query subscription stringsEventsReplayClient
to receive events from multiple sourcesevents
package documentationNon-goals / Non-deliverables
EventsQueryClient
logicGeneral deliverables
Creator: @h5law
Co-Owners: @bryanchriswhite
The text was updated successfully, but these errors were encountered: