Git Product home page Git Product logo

Comments (3)

jetbasrawi avatar jetbasrawi commented on September 26, 2024

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.

setyven avatar setyven commented on September 26, 2024

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)
screen shot 2017-01-19 at 12 27 37 am

Thanks a lot for your help.

from go.geteventstore.

jetbasrawi avatar jetbasrawi commented on September 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.