gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 21:51:12 25 4
gpt4 key购买 nike

成为 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));
}
}

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

Image of event store administation

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

Image of event store received event

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

最佳答案

这里的答案是 Event Store 的预测被禁用。

使用 --run-projections=all 启动商店

关于c# - 订阅类别流,事件永远不会出现在订阅客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35828118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com