コード例 #1
0
ファイル: FeedReader.cs プロジェクト: arthis/EventStore-1
        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);
        }
コード例 #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);
            }
コード例 #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);
            }
コード例 #4
0
            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);
            }
コード例 #5
0
ファイル: reordering.cs プロジェクト: zerox981/EventStore
            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);
            }
コード例 #6
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-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);
            }
コード例 #7
0
        private IReaderStrategy CreateReaderStrategy()
        {
            var result = new SourceDefinitionBuilder();

            result.FromAll();
            result.AllEvents();
            return(ReaderStrategy.Create(0, result.Build(), new RealTimeProvider(), stopOnEof: false, runAs: null));
        }
コード例 #8
0
    private ReaderStrategy ConfigureUsage()
    {
        ReaderStrategy result = new ReaderStrategy("USGE", typeof(Usage));

        result.AddFieldExtractor(4, 8, "CustomerID");
        result.AddFieldExtractor(9, 22, "CustomerName");
        result.AddFieldExtractor(30, 30, "Cycle");
        result.AddFieldExtractor(31, 36, "ReadDate");
        return(result);
    }
コード例 #9
0
    private ReaderStrategy ConfigureServiceCall()
    {
        ReaderStrategy result = new ReaderStrategy("SVCL", typeof(ServiceCall));

        result.AddFieldExtractor(4, 18, "CustomerName");
        result.AddFieldExtractor(19, 23, "CustomerID");
        result.AddFieldExtractor(24, 27, "CallTypeCode");
        result.AddFieldExtractor(28, 35, "DateOfCallString");
        return(result);
    }
コード例 #10
0
 protected virtual void When()
 {
     _ef = null;
     try {
         var sources = _builder.Build();
         _ef =
             ReaderStrategy.Create("test", 0, sources, new RealTimeProvider(), stopOnEof: false, runAs: null)
             .EventFilter;
     } catch (Exception ex) {
         _exception = ex;
     }
 }
コード例 #11
0
ファイル: FeedReader.cs プロジェクト: dhanzhang/EventStore
        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);
        }
コード例 #12
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);
        }
コード例 #13
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);
            }