First time user questions

Hi,

Just started with the Eventstore, and trying to find out it’s possibilities. I have it running but it gave way to some questions:

I’m running “EventStore.SingleNode --db data” which I have downloaded from GitHub. And I’m adding events using the C# ClientAPI. I’m just using the TestEvent that is defined in the Test cases like this:

using (var connection = EventStoreConnection.Create())
{
connection.Connect(tcp, null);
var append = connection.AppendToStreamAsync(stream, ExpectedVersion.NoStream, new[] { new TestEvent(data, headers) });
append.Wait();
}

where data and headers will translate into 2 empty (0x20) 400 byte arrays. Connection is made using TCP which I think would be the fastest type.

Question 1:

Calling the above code a couple of thousand times from 1 thread yields around 55 msg / sec. Is that the expected throughput?

Question 2.

I see that the ClientAPI only accepts IEvent type messages which means that any client must reference EventStore.ClientAPI.dll right?

Question 3.

In our case, the Eventstore would be used within a repository where I need to be transactional. So if my event publisher fails, the eventstore commit must be rolled back. And vice versa. There is a “DeleteStreamAsync” method in the API. Is that what I would use to “undo” in the EventStore? Do you have any description or something that shows in words or diagram how to incorporate the Eventstore in an existing transaction?

Thanks.

Hi Wener,

We’ve just made a push to master and will be releasing new binaries today - the binaries on github are very old.

There have been a number of changes to the client API which goes with the new version, but I’ll try and answer some of these questions now.

Re: 2 - The client API would likely only be used directly by a repository or some other wrapper for the most part. We don’t do any serialization in the client API, instead leaving the choice of serializer and format to the client application. See http://geteventstore.com/blog/20121121/105/ for a bit more info on that, and see https://gist.github.com/4430092 for an example implementation of a repository. To be clear, we recommend you do NOT implement IEvent on your domain events.

Re: 3 - it’s not recommended to delete streams in any exception exceptional circumstances. You may want to investigate an append-only model for your deletions instead. We do support transactional writing (StartTransaction on EventStoreConnection, TransactionalWrite and CommitTransaction on EventStoreTransaction which you get back). We don’t currently officially support the DTC (which is what I assume you want?), but it’s not impossible and is something we may add in the future. See https://gist.github.com/1de2dc287e880fd7f16c for an incredibly naive version of this.

Thanks,

James

Wy are you reconnecting every event? The connection itself handles reconnects.

Also your results are based on a singlemthread blocking in client. Try not blocking or using mutliple threads to increase perf.

We should delete ievent it confuses more people than it helps. Instead just have our event data object since the interface is data only.

Well with the version I have now (0.9.2) it really doesn’t make much a difference if I create a new connection or not (60 msg/sec). That said, there is a reason for creating new connection each time, sync operations and using one thread only. The use case is a repository which is fed messages from a single-threaded queue running in a distributed transaction. So there is only one thread going and I need to process the messages one at a time.

Yes probably, however I would not be confused if I had an option not to use IEvent. E.g. “AppendToStreamAsync” in the version I’m using (0.9.2), only accepts IEvent, so there is no other way - in this version.

Hi James,

Thanks, looking forward to the new version. The thing is, for some reason i can’t compile. V8 stops somewhere and complains that the configuration/platform isn’t available in the V8 source files. And Eventstore stops because I´m missing some files (e.g. Microsoft.Cpp.Default.props). I think I have to update my VS solution to include some C++ files? I’ll try later…

Due to confusion people are having I put a breaking change in to the event store to get rid of ievent.

The intention was never to have your events implement ievent.

Keep in mind when doing this that when you say “60/second” that’s including blocking on networks/hdd etc synchronously. Eg the event store must fsync your hdd as part of a transaction. You can either block on this or not (that’s why more than one thread can get much higher throughput)

Maybe making EventData sealed will help with understanding that events are not supposed to be inherited from it?

BTW, what I’ve done almost the same in my prototype: I created a TransportEventData : IEvent and a primitive translator that serializes my own events into json and builds up a TransportEventData instance.

Then I just use it internally when appending to a stream. The rest of my system doesn’t know about IEvent and doesn’t have references to EventStore.ClientApi.

Looks like now I don’t need this my TransportEventData and can just use EventData provided by the ClientApi :slight_smile:

Regards,

Alexey.

Quick off-topic question spins off your post: Can projections be created from any JSON-serialization - just as long as it is JSON? Or does it have to be the same serializer as the ES uses (Newtonsoft afaik)?

Any json so long as it can be read …and json flag is set.

What about BSON?

Var bsondata = BSON.parse(e.dataRaw)

Sorry dataRaw is a string …

We’ve changed EventData to be sealed as you suggest to try and reduce any unnecessary confusion.