Reputation: 1047
I'm using EventStoreDB V20 and 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'm using these nugets: https://www.nuget.org/packages/EventStore.Client.Grpc/ https://www.nuget.org/packages/EventStore.Client.Grpc.PersistentSubscriptions/20.10.0
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
For appending the events, I do:
await eventStoreClient.AppendToStreamAsync(
aggregate.Id.ToString(),
aggregate.Version == 0 ? StreamRevision.None : StreamRevision.FromInt64(aggregate.Version), events);
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("http://127.0.0.1:2113?Tls=false&TlsVerifyCert=false")
}});
await client.CreateAsync("all", "TestGroup", new PersistentSubscriptionSettings(startFrom: StreamPosition.End));
await SubscribeAsync(client);
Console.ReadLine();
}
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?
Upvotes: 1
Views: 1355
Reputation: 19630
Everything seems to be set up correctly, but I doubt you have the stream with the name all
. If you are trying to create a persistent subscription for the $all
stream, it is not possible. You can only have a catch-up subscription on the $all
stream.
Upvotes: 2