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 = false
                    }
                };
                _readerStrategy = ReaderStrategy.Create(
                    "test",
                    0,
                    _sourceDefinition,
                    _timeProvider,
                    stopOnEof: true,
                    runAs: null);
                _readerSubscriptionOptions = new ReaderSubscriptionOptions(
                    checkpointUnhandledBytesThreshold: 10000, checkpointProcessedEventsThreshold: 100, 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);
            }
            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, stopOnEof: true,
                    stopAfterNEvents: null);
            }
Example #4
0
 public IReaderSubscription CreateReaderSubscription(
     IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId,
     ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     if (_reorderEvents)
     {
         return(new EventReorderingReaderSubscription(
                    publisher,
                    subscriptionId,
                    fromCheckpointTag,
                    this,
                    _timeProvider,
                    readerSubscriptionOptions.CheckpointUnhandledBytesThreshold,
                    readerSubscriptionOptions.CheckpointProcessedEventsThreshold,
                    readerSubscriptionOptions.CheckpointAfterMs,
                    _processingLag,
                    readerSubscriptionOptions.StopOnEof,
                    readerSubscriptionOptions.StopAfterNEvents));
     }
     else
     {
         return(new ReaderSubscription(
                    _tag,
                    publisher,
                    subscriptionId,
                    fromCheckpointTag,
                    this,
                    _timeProvider,
                    readerSubscriptionOptions.CheckpointUnhandledBytesThreshold,
                    readerSubscriptionOptions.CheckpointProcessedEventsThreshold,
                    readerSubscriptionOptions.CheckpointAfterMs,
                    readerSubscriptionOptions.StopOnEof,
                    readerSubscriptionOptions.StopAfterNEvents));
     }
 }
            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);
            }
            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, stopOnEof: true,
                    stopAfterNEvents: null);
            }
Example #7
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, stopOnEof: false,
                    stopAfterNEvents: null);
            }
 public IReaderSubscription CreateReaderSubscription(
     IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId,
     ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     return(new ReaderSubscription(
                publisher, subscriptionId, fromCheckpointTag, this,
                readerSubscriptionOptions.CheckpointUnhandledBytesThreshold,
                readerSubscriptionOptions.CheckpointProcessedEventsThreshold, readerSubscriptionOptions.StopOnEof,
                readerSubscriptionOptions.StopAfterNEvents));
 }
 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;
 }
 public IReaderSubscription CreateReaderSubscription(
     IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId,
     ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     return new ReaderSubscription(
         publisher, subscriptionId, fromCheckpointTag, this,
         readerSubscriptionOptions.CheckpointUnhandledBytesThreshold,
         readerSubscriptionOptions.CheckpointProcessedEventsThreshold, readerSubscriptionOptions.StopOnEof,
         readerSubscriptionOptions.StopAfterNEvents);
 }
Example #11
0
 public IReaderSubscription CreateReaderSubscription(
     IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId,
     ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     if (_reorderEvents)
         return new EventReorderingReaderSubscription(
             publisher,
             subscriptionId,
             fromCheckpointTag,
             this,
             _timeProvider,
             readerSubscriptionOptions.CheckpointUnhandledBytesThreshold,
             readerSubscriptionOptions.CheckpointProcessedEventsThreshold,
             _processingLag,
             readerSubscriptionOptions.StopOnEof,
             readerSubscriptionOptions.StopAfterNEvents);
     else
         return new ReaderSubscription(
             _tag,
             publisher,
             subscriptionId,
             fromCheckpointTag,
             this,
             _timeProvider, 
             readerSubscriptionOptions.CheckpointUnhandledBytesThreshold,
             readerSubscriptionOptions.CheckpointProcessedEventsThreshold,
             readerSubscriptionOptions.StopOnEof,
             readerSubscriptionOptions.StopAfterNEvents);
 }
 public IReaderSubscription CreateReaderSubscription(
     IPublisher publisher, CheckpointTag fromCheckpointTag, Guid subscriptionId,
     ReaderSubscriptionOptions readerSubscriptionOptions)
 {
     throw new NotImplementedException();
 }