I create a CatchupSubscription, and implement the EventAppeared.
I add some logging in indicating when an Event appears, and as exepcetd they appear sequentially, one after another.
If I add an awaitable call in the eventhandler, the behaviour changes. As soon as it hits the await, more events appears start apeparing while the current event is being awaited on.
Is this expected, and perhaps my understand of the process is the problem?
Small code example:
String connectionString = “ConnectTo=tcp://admin:changeit@127.0.01:1113;VerboseLogging=true;”;
var eventStoreConnection = EventStoreConnection.Create(connectionString);
await eventStoreConnection.ConnectAsync();
String streamname = @"$et-myEvents";
var r = eventStoreConnection.SubscribeToStreamFrom(streamname, 0,
CatchUpSubscriptionSettings.Default,
async (subscription,
@event) =>
{
var request = BuildHttpRequestMessage(@event.OriginalEvent.Data);
var httpClient = GetHttpClient();
//When this code is hit, the next Event Appears!
await httpClient.SendAsync(request, CancellationToken.None);
});
Any ideas?