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
事件:
我有誤解的訂閱,溪流和團體是如何工作的?請賜教。