Subscribe to category stream, event never appears in subscription client

十年热恋 提交于 2019-12-12 19:09:28

问题


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));
    }
}

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:

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.


回答1:


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

Start the store with --run-projections=all



来源:https://stackoverflow.com/questions/35828118/subscribe-to-category-stream-event-never-appears-in-subscription-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!