Example #1
0
        public void Start()
        {
            var readerStrategy = ReaderStrategy.Create(
                _querySource.ToJson(),                 // tag
                0,
                _querySource,
                _timeProvider,
                stopOnEof: true,
                runAs: _user);

            //TODO: make reader mode explicit
            var readerOptions = new ReaderSubscriptionOptions(
                1024 * 1024,
                checkpointAfterMs: 10000,
                checkpointProcessedEventsThreshold: null,
                stopOnEof: true,
                stopAfterNEvents: _maxEvents,
                // The projection must be stopped for debugging, so will enable content type validation automatically
                enableContentTypeValidation: true);

            _subscriptionId =
                _subscriptionDispatcher.PublishSubscribe(
                    new ReaderSubscriptionManagement.Subscribe(
                        Guid.NewGuid(), _fromPosition, readerStrategy, readerOptions), this);
        }
Example #2
0
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();

                _tfPos1 = ExistingEvent("test-stream", "type1", "{}", "{Data: 1}");
                _tfPos2 = ExistingEvent("test-stream", "type1", "{}", "{Data: 2}");
                _tfPos3 = ExistingEvent("test-stream", "type2", "{}", "{Data: 3}");

                GivenInitialIndexState();

                _subscriptionId   = Guid.NewGuid();
                _sourceDefinition = new QuerySourcesDefinition
                {
                    AllStreams = true,
                    Events     = new[] { "type1", "type2" },
                    Options    = new QuerySourcesDefinitionOptions {
                    }
                };
                _readerStrategy = ReaderStrategy.Create(
                    "test",
                    0,
                    _sourceDefinition,
                    _timeProvider,
                    stopOnEof: false,
                    runAs: null);

                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100, stopOnEof: false,
                    stopAfterNEvents: null);
            }
Example #3
0
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                ExistingEvent("test-stream", "$>", "{}", "{Data: 1}");
                ExistingEvent("test-stream", "$>", "{}", "{Data: 2}");
                ExistingEvent("test-stream", "$>", "{}", "{Data: 3}");

                ExistingEvent("test-stream", "eventType", "{}", "{Data: 4}");
                ExistingEvent("test-stream", "eventType", "{}", "{Data: 5}");
                ExistingEvent("test-stream", "eventType", "{}", "{Data: 6}");
                ExistingEvent("test-stream", "eventType", "{}", "{Data: 7}");

                _subscriptionId   = Guid.NewGuid();
                _sourceDefinition = new QuerySourcesDefinition {
                    ByStreams  = true,
                    AllStreams = true,
                    AllEvents  = true,
                    Options    = new QuerySourcesDefinitionOptions {
                        IncludeLinks = true
                    }
                };
                _readerStrategy = ReaderStrategy.Create(
                    "test",
                    0,
                    _sourceDefinition,
                    _timeProvider,
                    stopOnEof: true,
                    runAs: null);
                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100,
                    checkpointAfterMs: 10000, stopOnEof: true,
                    stopAfterNEvents: null,
                    enableContentTypeValidation: true);
            }
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                ExistingEvent("test-stream", "type1", "{}", "{Data: 1}");
                ExistingEvent("test-stream", "type1", "{}", "{Data: 2}");
                ExistingEvent("test-stream2", "type1", "{}", "{Data: 3}");
                ExistingEvent("test-stream2", "type1", "{}", "{Data: 4}");
                ExistingEvent("test-stream3", "type1", "{}", "{Data: 5}");
                ExistingEvent("test-stream3", "type1", "{}", "{Data: 6}");
                ExistingEvent("test-stream4", "type1", "{}", "{Data: 7}");


                _subscriptionId = Guid.NewGuid();
                _readerStrategy = ReaderStrategy.CreateExternallyFedReaderStrategy(
                    "test",
                    0,
                    _timeProvider,
                    SystemAccount.Principal,
                    limitingCommitPosition: 10000);

                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100,
                    checkpointAfterMs: 10000, stopOnEof: true,
                    stopAfterNEvents: null);
            }
Example #5
0
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                ExistingEvent("stream-a", "type1", "{}", "{Data: 1}");
                ExistingEvent("stream-b", "type1", "{}", "{Data: 2}");

                GivenOtherEvents();

                _subscriptionId   = Guid.NewGuid();
                _sourceDefinition = new QuerySourcesDefinition {
                    Streams   = new[] { "stream-a", "stream-b" },
                    AllEvents = true,
                    Options   = new QuerySourcesDefinitionOptions {
                        ReorderEvents = true, ProcessingLag = 100
                    }
                };
                _readerStrategy = ReaderStrategy.Create(
                    "test",
                    0,
                    _sourceDefinition,
                    _timeProvider,
                    stopOnEof: false,
                    runAs: null);

                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100,
                    checkpointAfterMs: 10000, stopOnEof: false,
                    stopAfterNEvents: null);
            }
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                ExistingEvent("test-stream", "type1", "{}", "{Data: 1}");
                ExistingEvent("test-stream", "type1", "{}", "{Data: 2}");
                ExistingEvent("test-stream2", "type1", "{}", "{Data: 3}");

                ExistingEvent("test-stream2", "type1", "{}", "{Data: 4}");
                ExistingEvent("test-stream3", "type1", "{}", "{Data: 5}");
                ExistingEvent("test-stream3", "type1", "{}", "{Data: 6}");
                ExistingEvent("test-stream4", "type1", "{}", "{Data: 7}");

                ExistingEvent("$$test-stream", "$metadata", "", "{Meta: 1}");
                ExistingEvent("$$test-stream2", "$metadata", "", "{Meta: 2}");
                ExistingEvent("$$test-stream3", "$metadata", "", "{Meta: 3}");


                ExistingEvent("$streams", "$>", null, "0@test-stream");
                ExistingEvent("$streams", "$>", null, "0@test-stream2");
                ExistingEvent("$streams", "$>", null, "0@test-stream3");
                ExistingEvent("$streams", "$>", null, "0@test-stream4");
                NoOtherStreams();

                _subscriptionId = Guid.NewGuid();
                _readerStrategy = new ParallelQueryAllStreamsMasterReaderStrategy(
                    "test",
                    0,
                    SystemAccount.Principal,
                    _timeProvider);
                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100, checkpointAfterMs: 10000,
                    stopOnEof: true,
                    stopAfterNEvents: null);
            }
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                _tfPos1 = ExistingEvent("test-stream", "type1", "{}", "{Data: 1}");
                _tfPos2 = ExistingEvent("test-stream", "type1", "{}", "{Data: 2}");
                _tfPos3 = ExistingEvent("test-stream2", "type1", "{}", "{Data: 3}");
                ExistingEvent("test-stream2", "type1", "{}", "{Data: 4}");
                ExistingEvent("test-stream3", "type1", "{}", "{Data: 5}");
                ExistingEvent("test-stream3", "type1", "{}", "{Data: 6}");
                ExistingEvent("test-stream4", "type1", "{}", "{Data: 7}");

                ExistingEvent("catalog", "$>", null, "0@test-stream");
                ExistingEvent("catalog", "$>", null, "0@test-stream2");
                ExistingEvent("catalog", "$>", null, "0@test-stream3");

                _subscriptionId   = Guid.NewGuid();
                _sourceDefinition = new QuerySourcesDefinition
                {
                    CatalogStream = "catalog",
                    AllEvents     = true,
                    ByStreams     = true,
                    Options       = new QuerySourcesDefinitionOptions {
                    }
                };
                _readerStrategy            = ReaderStrategy.Create(0, _sourceDefinition, _timeProvider, stopOnEof: true, runAs: null);
                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100, stopOnEof: true,
                    stopAfterNEvents: null);
            }
Example #8
0
        public void Start()
        {
            var readerStrategy = ReaderStrategy.Create(0, _querySource, _timeProvider, stopOnEof: true, runAs: _user);
            //TODO: make reader mode explicit
            var readerOptions = new ReaderSubscriptionOptions(
                1024 * 1024, _maxEvents + 1, stopOnEof: true, stopAfterNEvents: _maxEvents);

            _subscriptionId =
                _subscriptionDispatcher.PublishSubscribe(
                    new ReaderSubscriptionManagement.Subscribe(
                        Guid.NewGuid(), _fromPosition, readerStrategy, readerOptions), this);
        }
 public Subscribe(
     Guid subscriptionId, CheckpointTag from,
     IReaderStrategy readerStrategy, ReaderSubscriptionOptions readerSubscriptionOptions) : base(subscriptionId)
 {
     if (@from == null)
     {
         throw new ArgumentNullException("from");
     }
     if (readerStrategy == null)
     {
         throw new ArgumentNullException("readerStrategy");
     }
     _fromPosition   = @from;
     _readerStrategy = readerStrategy;
     _options        = readerSubscriptionOptions;
 }
Example #10
0
        public void Start()
        {
            var readerStrategy = ReaderStrategy.Create(
                _querySource.ToJson(),                 // tag
                0,
                _querySource,
                _timeProvider,
                stopOnEof: true,
                runAs: _user);

            //TODO: make reader mode explicit
            var readerOptions = new ReaderSubscriptionOptions(
                1024 * 1024,
                checkpointAfterMs: 10000,
                checkpointProcessedEventsThreshold: null,
                stopOnEof: true,
                stopAfterNEvents: _maxEvents);

            _subscriptionId =
                _subscriptionDispatcher.PublishSubscribe(
                    new ReaderSubscriptionManagement.Subscribe(
                        Guid.NewGuid(), _fromPosition, readerStrategy, readerOptions), this);
        }
Example #11
0
            protected override void Given()
            {
                base.Given();
                AllWritesSucceed();
                _tfPos  = new TFPos[TailLength];
                _tfPos1 = ExistingEvent("test-stream", "type1", "{}", "{Data: 1}");
                _tfPos2 = ExistingEvent("test-stream", "type1", "{}", "{Data: 2}");
                _tfPos3 = ExistingEvent("test-stream", "type1", "{}", "{Data: 3}");

                for (var i = 0; i < TailLength; i++)
                {
                    _tfPos[i] = ExistingEvent("test-stream", "type1", "{}", "{Data: " + i + "}");
                }

                GivenInitialIndexState();

                _subscriptionId   = Guid.NewGuid();
                _sourceDefinition = new QuerySourcesDefinition {
                    AllStreams = true,
                    Events     = new[] { "type1", "type2" },
                    Options    = new QuerySourcesDefinitionOptions {
                    }
                };
                _readerStrategy = ReaderStrategy.Create(
                    "test",
                    0,
                    _sourceDefinition,
                    _timeProvider,
                    stopOnEof: false,
                    runAs: null);
                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100,
                    checkpointAfterMs: 10000, stopOnEof: false,
                    stopAfterNEvents: null,
                    enableContentTypeValidation: true);
            }
Example #12
0
 public IReaderSubscription CreateReaderSubscription(
     IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId,
     ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     throw new NotImplementedException();
 }
Example #13
0
 public IReaderSubscription CreateReaderSubscription(IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId, ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     _subscription = new FakeReaderSubscription();
     return(_subscription);
 }