Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public BankAccountGrain()
{
var settings = ConnectionSettings
.Create()
.EnableVerboseLogging()
.UseConsoleLogger();
_conn = EventStoreConnection.Create(settings, new IPEndPoint(IPAddress.Loopback, Defaultport));
}
public override async Task OnActivateAsync()
{
_stream = $"{GetType().Name}-{this.GetPrimaryKey()}";
await _conn.ConnectAsync();
StreamEventsSlice currentSlice;
var nextSliceStart = StreamPosition.Start;
do
{
currentSlice = await _conn.ReadStreamEventsForwardAsync(_stream, nextSliceStart, 200, false);
foreach (var evnt in currentSlice.Events)
{
base.RaiseEvent(DeserializeEvent(evnt.Event));
}
nextSliceStart = (int)currentSlice.NextEventNumber;
} while (!currentSlice.IsEndOfStream);
await ConfirmEvents();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.