public PersistentSubscription(PersistentSubscriptionParams persistentSubscriptionParams)
 {
     Ensure.NotNull(persistentSubscriptionParams.StreamReader, "eventLoader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointReader, "checkpointReader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointWriter, "checkpointWriter");
     Ensure.NotNull(persistentSubscriptionParams.MessageParker, "messageParker");
     Ensure.NotNull(persistentSubscriptionParams.SubscriptionId, "subscriptionId");
     Ensure.NotNull(persistentSubscriptionParams.EventStreamId, "eventStreamId");
     Ensure.NotNull(persistentSubscriptionParams.GroupName, "groupName");
     _lastPulledEvent = 0;            
     _totalTimeWatch = new Stopwatch();
     _settings = persistentSubscriptionParams;
     _totalTimeWatch.Start();
     _statistics = new PersistentSubscriptionStats(this, _settings, _totalTimeWatch);
     _outstandingMessages = new OutstandingMessageCache();
     InitAsNew();
 }
Example #2
0
 public PersistentSubscription(PersistentSubscriptionParams persistentSubscriptionParams)
 {
     Ensure.NotNull(persistentSubscriptionParams.StreamReader, "eventLoader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointReader, "checkpointReader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointWriter, "checkpointWriter");
     Ensure.NotNull(persistentSubscriptionParams.MessageParker, "messageParker");
     Ensure.NotNull(persistentSubscriptionParams.SubscriptionId, "subscriptionId");
     Ensure.NotNull(persistentSubscriptionParams.EventStreamId, "eventStreamId");
     Ensure.NotNull(persistentSubscriptionParams.GroupName, "groupName");
     _lastPulledEvent = 0;
     _totalTimeWatch  = new Stopwatch();
     _settings        = persistentSubscriptionParams;
     _totalTimeWatch.Start();
     _statistics          = new PersistentSubscriptionStats(this, _settings, _totalTimeWatch);
     _outstandingMessages = new OutstandingMessageCache();
     InitAsNew();
 }
 public PersistentSubscription(PersistentSubscriptionParams persistentSubscriptionParams)
 {
     Ensure.NotNull(persistentSubscriptionParams.StreamReader, "eventLoader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointReader, "checkpointReader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointWriter, "checkpointWriter");
     Ensure.NotNull(persistentSubscriptionParams.MessageParker, "messageParker");
     Ensure.NotNull(persistentSubscriptionParams.SubscriptionId, "subscriptionId");
     Ensure.NotNull(persistentSubscriptionParams.EventStreamId, "eventStreamId");
     Ensure.NotNull(persistentSubscriptionParams.GroupName, "groupName");
     _nextEventToPullFrom = 0;
     _totalTimeWatch      = new Stopwatch();
     _settings            = persistentSubscriptionParams;
     _totalTimeWatch.Start();
     _statistics          = new PersistentSubscriptionStats(this, _settings, _totalTimeWatch);
     _outstandingMessages = new OutstandingMessageCache();
     _streamBufferSource  = new TaskCompletionSource <StreamBuffer>(TaskCreationOptions.RunContinuationsAsynchronously);
     InitAsNew();
 }
 public PersistentSubscription(PersistentSubscriptionParams persistentSubscriptionParams)
 {
     Ensure.NotNull(persistentSubscriptionParams.StreamReader, "eventLoader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointReader, "checkpointReader");
     Ensure.NotNull(persistentSubscriptionParams.CheckpointWriter, "checkpointWriter");
     Ensure.NotNull(persistentSubscriptionParams.MessageParker, "messageParker");
     Ensure.NotNull(persistentSubscriptionParams.SubscriptionId, "subscriptionId");
     Ensure.NotNull(persistentSubscriptionParams.EventStreamId, "eventStreamId");
     Ensure.NotNull(persistentSubscriptionParams.GroupName, "groupName");
     if (persistentSubscriptionParams.ReadBatchSize >= persistentSubscriptionParams.BufferSize)
     {
         throw new ArgumentOutOfRangeException($"{nameof(persistentSubscriptionParams.ReadBatchSize)} may not be greater than or equal to {nameof(persistentSubscriptionParams.BufferSize)}");
     }
     _nextEventToPullFrom = 0;
     _totalTimeWatch      = new Stopwatch();
     _settings            = persistentSubscriptionParams;
     _totalTimeWatch.Start();
     _statistics          = new PersistentSubscriptionStats(this, _settings, _totalTimeWatch);
     _outstandingMessages = new OutstandingMessageCache();
     _streamBufferSource  = new TaskCompletionSource <StreamBuffer>(TaskCreationOptions.RunContinuationsAsynchronously);
     InitAsNew();
 }