2
作为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。在我的事件商店,我能看到的管理面板有竞争消费者标签此流/组的连接:
但是,如果我发送一个事件喜欢happening-<guid>
它显示了在流浏览器,但我的订阅客户端从来没有得到一个event appeared
事件:
我有误解的订阅,溪流和团体是如何工作的?请赐教。