Hi all,
I am using the .NET EventStore.Client (5.0.1) and I need to implement something to replay all events so that my “new” read models can be created by projecting the info of these full history of events.
The problem is that the method does not find any events in EventStore.
This is my code:
public async Task<IEnumerable<IPersistableEvent>> GetAllEvents()
{
var allResolvedEvents = new List<ResolvedEvent>();
AllEventsSlice currentSlice;
var nextSliceStart = Position.Start;
do
{
currentSlice =
await _eventStoreConnection.ReadAllEventsBackwardAsync(nextSliceStart, 200, false);
nextSliceStart = currentSlice.NextPosition;
var resolvedEvents = currentSlice.Events;
allResolvedEvents.AddRange(resolvedEvents);
}
while (!currentSlice.IsEndOfStream);
var persistableEvents =
allResolvedEvents
.Select(x =>
{
var resolvedEventWrapper = _resolvedEventWrapperFactory.Create(x);
var persistableEvent = _persistableEventMapper.Map(resolvedEventWrapper);
return persistableEvent;
})
.ToList();
return persistableEvents;
}
I am running a single node locally and I am able to persist events and read from a specific stream properly. This is how I launch the server.
C:\EventStore-OSS-Win-v5.0.1>EventStore.ClusterNode.exe --mem-db
I read somewhere that maybe I should enable projections with
–run-projections=all
but that didn’t make any difference. The documentation here https://eventstore.org/docs/dotnet-api/reading-events/index.html#read-all-events does not mention anything else.
Am I missing something else?
Thanks