How do I setup an persistent subscriptions client correctly?


I’m trying to setup a persistent subscription on my local dev machine. On the dashboard I can see the persistent subscription listed but the handler never gets called.

I run EventStore in docker:
docker run --name esdb-node -it -p 2113:2113 -p 1113:1113 -e EVENTSTORE_DEV=true eventstore/eventstore:latest --insecure --run-projections=All --enable-atom-pub-over-http

Appending the events:

await eventStoreClient.AppendToStreamAsync(
        aggregate.Version == 0 ? StreamRevision.None : StreamRevision.FromInt64(aggregate.Version),

Creating and subscribe to persistent subscription:

var client = new EventStorePersistentSubscriptionsClient(new EventStoreClientSettings {

    CreateHttpMessageHandler = () =>
        new HttpClientHandler
            ServerCertificateCustomValidationCallback =
                (message, certificate2, x509Chain, sslPolicyErrors) => true // ignore https
    ConnectivitySettings = new EventStoreClientConnectivitySettings
        Address = new Uri("")

    await client.CreateAsync("all", "TestGroup", new PersistentSubscriptionSettings(startFrom: StreamPosition.End));

    await SubscribeAsync(client);


    private static Task<PersistentSubscription> SubscribeAsync(EventStorePersistentSubscriptionsClient client)
        return client.SubscribeAsync("all", "TestGroup",
            (subscription, evt, retryCount, cancelToken) =>
                Console.WriteLine("Received: " + Encoding.UTF8.GetString(evt.Event.Data.Span));

                return Task.CompletedTask;

Console.WriteLine gets never called. What do I need to change?