Still having problems with JOES Repository

I had to make some minor changes to James’s code.

The implementation of Save below doesn’t handle a null parameter for updateHeaders

public void Save(IAggregate aggregate, Guid commitId,
Action<IDictionary<string, object>> updateHeaders)

{

if(updateHeaders != null)

updateHeaders(commitHeaders);

}

I also don’t understand how the GetById sets the actual aggregate Id. CommonDomain has an abstract factory method. The code I got from somewhere on the web uses a convention for aggregate construction - every aggregate has a private constructor that has one guid parameter. James, how does your implementation set the Id in GetById<>?

Ok so now using https://github.com/EventStore/getting-started-with-event-store/tree/WithoutStreamCreated

This version fixed the WrongExpectedVersion https://github.com/EventStore/getting-started-with-event-store/tree/WithoutStreamCreated

But now I’m getting an error in DeserializeEvent when reading from the eventstore.

Error reading JObject from JsonReader. Path ‘’, line 0, position 0.

Hi Craig,

  1. Re: updateHeaders - that’s a sensible change that I hadn’t considered, I’ll add that fix to the gist

  2. For setting the aggregate ID I’d assumed you’d do that during the first event in the stream (https://github.com/EventStore/getting-started-with-event-store/blob/master/src/GetEventStoreRepository.Tests/TestAggregate.cs#L15) - you could instead use the IConstructAggregates approach that the CommonDomain JOES integration code uses if you wanted to though.

  3. Do you have a stack trace for this? I guess it’s either because data or (probably) metadata aren’t being passed in, but not sure why that would happen offhand?

Cheers,

James

Hi James,

  1. Ok

  2. Makes perfect sense (doh).

  3. Yep the data is blank for the first event in the currentSlice

Stack trace is not very enlightning

[Newtonsoft.Json.JsonReaderException] {“Error reading JObject from JsonReader. Path ‘’, line 0, position 0.”} Newtonsoft.Json.JsonReaderException

Message “Error reading JObject from JsonReader. Path ‘’, line 0, position 0.” string

Are you running the dev branch binaries or the released ones? If you’re on the released ones you need to be on the master branch of getting-started-with-eventstore repository. One of the changes made for v2 (on dev) is that stream metadata is now in a separate stream rather than a $streamCreated event. You’re likely unsuccessfully trying to deserialize the $streamCreated by the look of it :slight_smile:

James

Hi James, I was running the latest Client API with the release binaries. I’ve pulled the source and tried building the dev branch but no success.

However using Client API 1.0.1 and binaries 1.01 worked.

BUT we must have the catchup subscriptions which is in a later API

How do you suggest I proceed, given I don’t want to build the source?

Hi,

Sorry for the delay in my reply.

The changes on dev mean a fairly different client API (we’re trying to follow semver, and it’s a major version bump so breaking changes are OK). For instance, it now supports authentication/authorization etc.

I guess we could post unstable binaries (don’t really want to do one per push though, there are lots of them per day). We’re expecting to do a substantial release (2.0.0) late this week or early next.

FWIW, there’s a script for Windows that will get all dependencies and build ES - https://github.com/EventStore/EventStore/blob/dev/src/EventStore/Scripts/windows/get-dev-on-win64.cmd

Cheers,

James

Hi, I’m staying with the version 1 for now as we don’t need the auth features, and there are lots of changes happening in the dev branch.

I have copied the EventStoreCatchUpSubscription and removed the auth features - basically made it work with V1 APIs, I need to do more testing here. But I’m having problems with the jo_importer. The importer and JOES repository seem to have different metadata formats.

Cheers, Craig.

The importer was written a while ago. It’s quite likely that it’s changed.

I’ll look at updating it today - that stuff was written quite a while back.