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
イベントを取得しません。
サブスクリプション、ストリーム、グループの仕組みについて誤解していませんか? 教えてください。