Hi All,
I’m trying to replicate the catch up subscriptions example from:
http://geteventstore.com/blog/20130707/catch-up-subscriptions-with-the-event-store/index.html
I realise things may have changed with ES 3.0.1.
I’m starting the event store as follows:
EventStore.ClusterNode –db=data –stats-period-sec 2
This is successfully starting and giving me events on the $stats stream.
I then have the following code in a standard console application:
using
EventStore.ClientAPI;
using
System;
using
System.Net;
using
System.Threading.Tasks;
using
System.IO;
using
System.Reflection;
namespace
EventStoreTest
{
class
Program
{
static
void Main(string []
args)
{
IEventStoreConnection connection =
null;
using (connection =EventStoreConnection.Create(new
IPEndPoint(IPAddress .Loopback,
1113)))
{
connection.ConnectAsync();
EventStoreCatchUpSubscription sub = connection.SubscribeToStreamFrom("$stats-127.0.0.1:2113",
StreamCheckpoint.StreamStart,
true, EventAccepted, GoneLive, SubscriptionDropped);
Console.ReadLine();
}
}
private
static
void SubscriptionDropped(EventStoreCatchUpSubscription
arg1, SubscriptionDropReason arg2,
Exception arg3)
{
Console.WriteLine( “subscription
dropped.”);
}
private
static
void GoneLive(EventStoreCatchUpSubscription
obj)
{
Console.WriteLine( “Gone
live”);
}
private
static
void EventAccepted(EventStoreCatchUpSubscription
arg1, ResolvedEvent arg2)
{
Console.WriteLine( “Event
accepted.”);
}
}
}
The SubscriptionDropped method always gets called, but neither the goneLive or EventAccepted ever do.
It seems from the acception that the connection is being closed and that I’m getting a message that read access is denied for the $stats stream.
The exception stack trace is below:
System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=EventStoreTest
StackTrace:
at EventStoreTest.Program.SubscriptionDropped(EventStoreCatchUpSubscription arg1, SubscriptionDropReason arg2, Exception arg3) in z:\work\EventStoreTest\EventStoreTest\Program.cs:line 32
at EventStore.ClientAPI.EventStoreCatchUpSubscription.DropSubscription(SubscriptionDropReason reason, Exception error)
at EventStore.ClientAPI.EventStoreCatchUpSubscription.b__0(Object _)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException: EventStore.ClientAPI.Exceptions.AccessDeniedException
HResult=-2146233088
Message=Read access denied for stream ‘$stats-127.0.0.1:2113’.
InnerException:
I was under the impression that the .net client connected as an admin user hence could read all streams.
Any help appreciated.
Kind regards
Sean.