【问题标题】:Subscribe to category stream, event never appears in subscription client订阅分类流,订阅客户端中永远不会出现事件
【发布时间】:2016-03-06 14:33:41
【问题描述】:

作为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 事件:

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

【问题讨论】:

    标签: c# cqrs event-sourcing eventstoredb


    【解决方案1】:

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

    --run-projections=all开店

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-05
      • 2021-12-22
      • 2020-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-14
      相关资源
      最近更新 更多