订阅类别流,事件永远不会出现在订阅客户端中 [英] Subscribe to category stream, event never appears in subscription client

查看:116
本文介绍了订阅类别流,事件永远不会出现在订阅客户端中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为 GetEventStore 的初次用户,并且阅读了文档之后,我遇到了一个问题,即事件永远不会出现在我的文档中订阅客户端.

Being a first time user of GetEventStore and having read the docs, I have an issue where events never appears on my subscription client.

由于我错过了配置步骤,所以有可能.

This is possible due to a configuration step I've missed.

具有此控制台应用程序客户端:

Having this console application client:

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 .在我的活动存储的管理面板中,我可以在竞争消费者选项卡上看到与此流/组的连接:

Upon starting this console application, the connection goes fine to http://myserver:1113. In the administration panel of my event store I can see there is a connection to this stream/group on the competing consumers tab:

但是,如果我发送类似happening-<guid>的事件,它将显示在流浏览器中,但是我的订阅客户端永远不会收到event appeared事件:

But if I send a event like to happening-<guid> it shows up on the stream browser, but my subscription client never gets an event appeared event:

我是否误解了订阅,流和组的工作方式?请赐教.

Have I misunderstood on how subscriptions, streams and groups works? Please enlighten me.

推荐答案

此处的答案是事件存储区的投影已被禁用.

The answer here is that projections for the Event Store was disabled.

使用--run-projections=all

这篇关于订阅类别流,事件永远不会出现在订阅客户端中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆