订阅类别流,事件永远不会出现在订阅客户端中

jan*_*ann 4 c# cqrs event-sourcing eventstoredb

作为GetEventStore的第一次用户并阅读了文档,我遇到了一个问题,即事件从未出现在我的订阅客户端上。

由于我错过了一个配置步骤,这是可能的。

拥有此控制台应用程序客户端:

public class EventStoreSubscriptionClient : ISubscriptionClient
{
    private const string GroupName = "liner";
    private const string StreamName = "$ce-happening";

    private readonly IProvideEventStoreConnection _eventStoreConnection;
    private readonly UserCredentials _userCredentials;

    private EventStorePersistentSubscriptionBase EventStorePersistentSubscriptionBase { get; set; }

    public EventStoreSubscriptionClient(IProvideEventStoreConnection eventStoreConnection, UserCredentials userCredentials)
    {
        _eventStoreConnection = eventStoreConnection;
        _userCredentials = userCredentials;
    }

    public void Connect()
    {
        var connection = _eventStoreConnection.ConnectAsync().Result;
        EventStorePersistentSubscriptionBase = connection.ConnectToPersistentSubscription(
               StreamName,
               GroupName,
               EventAppeared,
               SubscriptionDropped,
               _userCredentials,
               10,
               false
        );
    }

    private void SubscriptionDropped(EventStorePersistentSubscriptionBase subscription, SubscriptionDropReason reason, Exception ex)
    {
        Connect();
    }

    private async void EventAppeared(EventStorePersistentSubscriptionBase subscription, ResolvedEvent resolvedEvent)
    {
        Console.WriteLine("Event appeared: " + resolvedEvent.Event.EventId);
    }

    public void Dispose()
    {
        EventStorePersistentSubscriptionBase.Stop(TimeSpan.FromSeconds(15));
    }
}
Run Code Online (Sandbox Code Playgroud)

启动此控制台应用程序后,与http://myserver:1113的连接正常。在我的事件商店的管理面板中,我可以看到在竞争消费者选项卡上有一个到这个流/组的连接:

事件存储管理的图像

但是,如果我发送一个类似于happening-<guid>它的事件显示在流浏览器上,但我的订阅客户端从未收到event appeared事件:

事件存储接收事件的图像

我是否误解了订阅、流和群组的工作方式?请赐教。

jan*_*ann 5

答案是禁用了 Event Store 的投影。

开始商店 --run-projections=all