Comments (3)
Hi Setyven,
This is by design and is described in the documentation for the Next() method.
// Next gets the next event on the stream.
//
// Next should be treated more like a cursor over the stream rather than an
// enumerator over a collection of results. Individual events are retrieved
// on each call to Next().
//
// The boolean returned is intended to provide a convenient mechanism to
// to enumerate and process events, it should not be considered an indication
// of the status of a call to Next(). To understand the outcomes of operations the
// stream's Err() field should be inspected. It is left to the user to determine
// under what conditions to exit the loop.
from go.geteventstore.
Hi Jet, thanks for responding.
I use it as you suggested, so in the part of my code that processes each event, I inspect the StreamReader.Err()
. Correct me if I'm wrong, but what I found out was, failure to fetch an event will cause the stream reader to get stuck with that event, even though my event handler already decides to skip it. An example of that would be when an event is permanently deleted, then a HTTP call to event store would return 410, which is then translated to goes.ErrDeleted
.
Now, when Next()
encounters this, it would immediately fails after trying to retrieve the event via s.client.GetEvent(url)
and would return true without incrementing/decrementing the counter. Here's the part of the code in streamreader.go
that I suspect (line 125)
Thanks a lot for your help.
from go.geteventstore.
If the event has not successfully been loaded then the streamreader should not increment. If you want to move onto the next index you can increment the version on the reader and then continue to call next.
This behaviour allows the consumer to process the error and decide what to do next.
from go.geteventstore.
Related Issues (8)
- NextVersion HOT 2
- use of internal uuid package causes errors in forks HOT 7
- `Concurrency Error.` that NewEvent() doesn't support the `map[string]interface{}` type HOT 1
- Proposal: Add Competing Consumers HOT 5
- Next() does returns current event. HOT 2
- Headers are shared across multiple StreamReaders
- Successful response but no event HOT 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 go.geteventstore.