Git Product home page Git Product logo

go.geteventstore's People

Contributors

jetbasrawi avatar koalalorenzo avatar pgermishuys avatar thomasferro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

go.geteventstore's Issues

NextVersion

Hi,

for some reason, calling NextVersion does not seem to start reading at the given offset.

Let's say I have 5 events in a stream (EventStore 3.8.x), and I execute

     requestReader := commandListener.EventStoreClient.NewStreamReader(requestsStreamName)
     requestReader.NextVersion(3)

     for requestReader.Next() {
         if requestReader.Err() != nil {
             panic("error")
    } else {
            log.WithFields(logrus.Fields{
        "currentEvent": requestReader.EventResponse().Event.EventNumber,
     }).Info("Current Event")
        }
     }

I get the output :

Current Event currentEvent=0
Current Event currentEvent=1
Current Event currentEvent=2
Current Event currentEvent=3

In addition, if I pick a NextVersion higher than the default page size (20), it is not restarting from 0.

I can see that there is an automated test asserting that this works, but for some reason running the tests complains on my machine about the internal uuid package.

Next() does returns current event.

Here is my code, it pulls an event (which is a Click) and the next time it pulls the next event in the stream. However I get the same event back every time.

I can only get it wokring by storing a local version and calling NextVersion(r.version++) every time.

Here is my Next method which calls the stream readers next function.

func (r *Reader) Next() (*stream.Click, error) {
	r.lock.Lock()
	defer r.lock.Unlock()

	if !r.client.Next() {
		return nil, io.EOF
	}

	if err := r.client.Err(); err != nil {
		if _, ok := err.(*goes.ErrNoMoreEvents); ok {
			return nil, io.EOF
		}

		return nil, err
	}

	o := &stream.Click{}
	return o, r.client.Scan(&o, nil)
}

Infinite loop when failing to get event

Client.GetEvent triggers Client.Do that in a nutshell will hit the API for the given event stream. When this request fails, for instance if EventStore returns 410 for deleted stream, this function Client.Do will return that error, which is caught in streamreader.go line 123 within the Next() function. When catching this error, the function will immediately returns true, without incrementing s.version and s.nextVersion causing the reader to never move on from this particular event stream.

Headers are shared across multiple StreamReaders

The concurrent use of multiple StreamReaders means that when using a LongPoll for example, the (normal) reading of a stream is executed after the duration of the LongPoll interval.

This is due to the headers that are declared directly on the client and thus shared across all StreamReaders.

In my opinion, the relevant headers (including "ES-LongPoll") should be carried by the StreamReader and not by the client.

Since the method SetHeader() belongs to the global API of the client, of course, additional headers could be set from outside. To maintain these "external" headers, a workaround when generating the StreamReader would be to create a copy of the client and take all headers except "ES-LongPoll" (or other relevant ES-* headers).

Keeping the HTTP client, the baseURL and the credentials only once in the client makes sense, but not the headers I guess.

Successful response but no event

Hi I like the simplicity of this library so thank you very much.
I have an issue where I am appending an event but most of the time it does not appear in the EventStore

The EventStore log shows this:
image

My source code is here if you would be able to take a look
github.com/Brandon2255p/watermill-eventstore/eventstore

use of internal uuid package causes errors in forks

Hi,

if someone wants to fork this package it throws an error on compiling/testing in the forked folder

package github.com/forkinguser/go.geteventstore
imports github.com/jetbasrawi/go.geteventstore/internal/uuid: use of internal package not allowed

I can't see the usefulness of including the satori/go.uuid package in the repository. A better solution would be to import the original package or getting rid of it completely requiring the user to provide a uuid on firing events.

Regards,

Chris

`Concurrency Error.` that NewEvent() doesn't support the `map[string]interface{}` type

The error occurred:

2017/01/09 04:33:52 http: panic serving [::1]:53823: Concurrency Error.

When I was using map[string]interface{} as the data, meta type.

err := svc.ES.NewStreamWriter("uppercase").Append(nil, goes.NewEvent(
		"", "",
		map[string]interface{}{"input": s, "output": u},
		map[string]interface{}{},
	))

Everything's ok If I changed map[string]interface{} to map[string]string.

err := svc.ES.NewStreamWriter("uppercase").Append(nil, goes.NewEvent(
		"", "",
		map[string]string{"input": s, "output": u},
		map[string]string{},
	))

Any plans to support the map[string]interface{} type? Or am I using it in the wrong way?

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.