Apologies, about this simple question. I have EventStore running locally and can login and click on:
Stream Browser
but unfortunately I see:
No recently created streams
Despite seemingly successfully publishings a test event every 0.5 seconds from a C# client like so:
var jsonString = JsonConvert.SerializeObject(someTestEvent, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.None });
var jsonPayload = Encoding.UTF8.GetBytes(jsonString);
var guid = new Guid(“d5535cc7-7ac8-422f-b5f0-9a73df42d971”);
var eventStoreDataType = new EventData(guid, evt.GetType().Name, true, jsonPayload, null);
connection.AppendToStreamAsync(guid.ToString(), ExpectedVersion.Any, eventStoreDataType);
Can I browse the stream:
d5535cc7-7ac8-422f-b5f0-9a73df42d971
in the browser (tried to insert guid into search text box)? Any feedback or pointers to the relevant doc would be very much appreciated (googled extensively). Thanks.
I believe you need to have projections running for this to work.
Thanks for the reply. Why do I need to project anything in EventStore? At the moment, even this consumer code:
var guid = new Guid(“d5535cc7-7ac8-422f-b5f0-9a73df42d971”);
var results = Task.Run(() => connection.ReadStreamEventsForwardAsync(guid.ToString(), StreamPosition.Start, 2, false));
Task.WaitAll();
does not produce anything. By the way, I am using this:
var settings = ConnectionSettings.Create();
var connection = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Loopback, 1113));
also tried:
var settings = ConnectionSettings.Create();
var connection = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Loopback, 2113));
as the browser uses the port: 2113
I am pretty sure that the list of recently created streams is in fact a projection.
Thanks but this ‘consumer code’:
var guid = new Guid(“d5535cc7-7ac8-422f-b5f0-9a73df42d971”);
var results = Task.Run(() => connection.ReadStreamEventsForwardAsync(guid.ToString(), StreamPosition.Start, 2, false));
Task.WaitAll();
should at least return something shouldn’t it?
I don’t see where you are awaiting the result of appendToStreamAsync. I don’t think tasks are guaranteed to run without that or Task.Run
Also tried:
Task.Run(() => connection.AppendToStreamAsync(guid.ToString(), ExpectedVersion.Any, eventStoreDataType));
no success …
This makes even less sense than the first bit of code.
Try running with --run-projections=system or --run-projections=all
Greg
Thanks Greg. Sorry what does not makes sense? I am trying to use this as a starting point:
https://github.com/bl1nkr/SimpleEventStoreDemo
Also, where do I run:
–run-projections=system or --run-projections=all
Those are command line arguments (or config file entries though cased
differently)
Task.Run(() => SomeAsyncOperation())
This says "make a new task and run my async operation which I won't block on"
What you are probably looking for is:
connection.AppendToStreamAsync(guid.ToString(),
ExpectedVersion.Any, eventStoreDataType).Wait()
or
await connection.AppendToStreamAsync(guid.ToString(),
Thanks makes all sense. Had already tried this. Turns out, I forgot: connection.ConnectAsync(); sorry for wasting your time.
If you have a .wait() you should get an exception for that. If never
awaiting I would guess it depends on the context of the async
operation