问题
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