コード例 #1
0
        public void SetUp()
        {
            _connection = new FakeEventStoreConnection();
            _raisedEvents = new List<ResolvedEvent>();
            _dropEvent = new ManualResetEventSlim();
            _raisedEventEvent = new ManualResetEventSlim();
            _liveProcessingStarted = false;
            _isDropped = false;
            _dropReason = SubscriptionDropReason.Unknown;
            _dropException = null;

            var settings = new CatchUpSubscriptionSettings(1, 1, false, false);
            _subscription = new EventStoreStreamCatchUpSubscription(_connection, new NoopLogger(), StreamId, null, null,
                (subscription, ev) =>
                {
                    _raisedEvents.Add(ev);
                    _raisedEventEvent.Set();
                },
                subscription =>
                {
                    _liveProcessingStarted = true;
                },
                (subscription, reason, ex) =>
                {
                    _isDropped = true;
                    _dropReason = reason;
                    _dropException = ex;
                    _dropEvent.Set();
                },
                settings);
        }
コード例 #2
0
        public EventStoreStreamCatchUpSubscription SubscribeToStreamFrom(string stream,
                                                                         int?fromEventNumberExclusive,
                                                                         bool resolveLinkTos,
                                                                         Action <EventStoreCatchUpSubscription, ResolvedEvent> eventAppeared,
                                                                         Action <EventStoreCatchUpSubscription> liveProcessingStarted = null,
                                                                         Action <EventStoreCatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped = null,
                                                                         UserCredentials userCredentials = null)
        {
            Ensure.NotNullOrEmpty(stream, "stream");
            Ensure.NotNull(eventAppeared, "eventAppeared");
            var catchUpSubscription =
                new EventStoreStreamCatchUpSubscription(this, _settings.Log, stream, fromEventNumberExclusive,
                                                        resolveLinkTos, userCredentials, eventAppeared,
                                                        liveProcessingStarted, subscriptionDropped, _settings.VerboseLogging);

            catchUpSubscription.Start();
            return(catchUpSubscription);
        }
コード例 #3
0
 public EventStoreStreamCatchUpSubscription SubscribeToStreamFrom(string stream,
                                                                  int? fromEventNumberExclusive,
                                                                  bool resolveLinkTos,
                                                                  Action<EventStoreCatchUpSubscription, ResolvedEvent> eventAppeared,
                                                                  Action<EventStoreCatchUpSubscription> liveProcessingStarted = null,
                                                                  Action<EventStoreCatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped = null,
                                                                  UserCredentials userCredentials = null,
                                                                  int readBatchSize = 500)
 {
     Ensure.NotNullOrEmpty(stream, "stream");
     Ensure.NotNull(eventAppeared, "eventAppeared");
     var catchUpSubscription =
             new EventStoreStreamCatchUpSubscription(this, _settings.Log, stream, fromEventNumberExclusive, 
                                                     resolveLinkTos, userCredentials, eventAppeared, 
                                                     liveProcessingStarted, subscriptionDropped, _settings.VerboseLogging, readBatchSize);
     catchUpSubscription.Start();
     return catchUpSubscription;
 }