Comments (5)
Definitely!
from goes.
I'm thinking we should have a consume method on the subscription that returns two channels and an error, the first channel would provide access to the events rendered to that subscription and the second would provide access to the reason a subscription was terminated.
This would then allow the use of the select block to iterate over messages appearing on both channels simultaneously.
How does this sound? Also, what tests should we have for this?
from goes.
@SeanFarrow i'm keen to see how this would work out. Is this a bad approach? https://github.com/pgermishuys/goes/blob/master/eventstore/subscription.go#L47
from goes.
@pgermishuys,
I'm not saying it's a bad idea, just that it's not as go centric as other messaging solutions.
If you look at the way amqp does this,
here
You create a channel, which would be equivalent to a subscription, then consume from that, giving you a go channel, which closes once no more items are available.
Given the client provides the reason why the subscription was terminated, I'm suggesting we do one of the following:
Either add an item envelope structure that can either hold an event or an object detailing why the subscription terminated.
Or (the prefered option), Have two channels returned from a consume method on the subscription that could both be iterated over.
Having a consume method would replace start in my thinking. so you would create the subscription, then consume from it.
Hope that makes sense.
from goes.
It makes sense! thanks for the explanation!
Let's do it!
from goes.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goes.