Example #1
0
        public CommitPollingClient2(
            IPersistence persistStreams,
            ICommitEnhancer enhancer,
            String id,
            ILogger logger,
            INStoreLoggerFactory factory)
        {
            if (persistStreams == null)
            {
                throw new ArgumentNullException(nameof(persistStreams));
            }

            if (enhancer == null)
            {
                throw new ArgumentNullException(nameof(enhancer));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _enhancer    = enhancer;
            _consumers   = new List <ITargetBlock <IChunk> >();
            _logger      = logger;
            _id          = id;
            Status       = CommitPollingClientStatus.Stopped;
            _persistence = persistStreams;
            _factory     = factory;

            _logger.InfoFormat("Created Commit Polling client id: {0}", id);
        }
Example #2
0
 public PollingObserveCommits(IPersistStreams persistStreams, int interval, string checkpointToken, ICommitEnhancer enhancer, bool boost, IConcurrentCheckpointTracker tracker)
 {
     _persistStreams  = persistStreams;
     _checkpointToken = checkpointToken;
     _enhancer        = enhancer;
     _interval        = interval;
     _boost           = boost;
     _tracker         = tracker;
 }
Example #3
0
 /// <summary>
 /// Project an atomic readmodel.
 /// </summary>
 /// <param name="commitEnhancer"></param>
 /// <param name="stopCondition">This condition will be evaluated BEFORE the changeset will be processed
 /// by the readmodel, if the return value is true, the iteration will stop.</param>
 public AtomicReadModelSubscription(
     ICommitEnhancer commitEnhancer,
     TModel readModel,
     Func <Changeset, Boolean> stopCondition)
 {
     _commitEnhancer = commitEnhancer;
     _stopCondition  = stopCondition;
     _readModel      = readModel;
 }
Example #4
0
 public LiveAtomicReadModelProcessor(
     IAtomicReadModelFactory atomicReadModelFactory,
     ICommitEnhancer commitEnhancer,
     IPersistence persistence)
 {
     _commitEnhancer         = commitEnhancer;
     _persistence            = persistence;
     _atomicReadModelFactory = atomicReadModelFactory;
 }
Example #5
0
 public EventStreamController(
     IStoreEvents eventStore,
     ICommitEnhancer enhancer,
     IHandleMapper handleMapper,
     IIdentityConverter identityConverter)
 {
     _enhancer          = enhancer;
     _commits           = (ICommitEvents)eventStore;
     _handleMapper      = handleMapper;
     _identityConverter = identityConverter;
 }
 public EventStreamController(
     IStoreEvents eventStore, 
     ICommitEnhancer enhancer,
     IHandleMapper handleMapper,
     IIdentityConverter identityConverter)
 {
     _enhancer = enhancer;
     _commits = (ICommitEvents)eventStore;
     _handleMapper = handleMapper;
     _identityConverter = identityConverter;
 }
 public CommitPollingClient2(
     IPersistStreams persistStreams,
     ICommitEnhancer enhancer,
     String id,
     ILogger logger)
 {
     if (persistStreams == null)
     {
         throw new ArgumentNullException("persistStream");
     }
     _enhancer      = enhancer;
     _consumers     = new List <ITargetBlock <ICommit> >();
     _persistStream = persistStreams;
     _logger        = logger;
     _id            = id;
     Status         = CommitPollingClientStatus.Stopped;
 }
Example #8
0
        public JarvisPollingClient(IPersistStreams persistStreams, int interval, ICommitEnhancer enhancer, bool boost, IConcurrentCheckpointTracker tracker)
            : base(persistStreams)
        {
            if (persistStreams == null)
            {
                throw new ArgumentNullException("persistStreams");
            }
            if (interval <= 0)
            {
                throw new ArgumentException("interval");

                //                throw new ArgumentException(NEventStore.Messages.MustBeGreaterThanZero.FormatWith("interval"));
            }
            _interval = interval;
            _enhancer = enhancer;
            _boost    = boost;
            _tracker  = tracker;
        }
Example #9
0
 public JarvisPollingClientTpl(
     IPersistStreams persistStreams,
     int interval,
     ICommitEnhancer enhancer,
     bool boost)
     : base(persistStreams)
 {
     if (persistStreams == null)
     {
         throw new ArgumentNullException("persistStreams");
     }
     if (interval <= 0)
     {
         throw new ArgumentException("interval");
     }
     _interval = interval;
     _enhancer = enhancer;
     _boost    = boost;
 }
Example #10
0
        public AtomicProjectionEngine(
            IPersistence persistence,
            ICommitEnhancer commitEnhancer,
            AtomicProjectionCheckpointManager atomicProjectionCheckpointManager,
            IAtomicReadmodelProjectorHelperFactory atomicReadmodelProjectorHelperFactory,
            INStoreLoggerFactory nStoreLoggerFactory)
        {
            Logger = NullLogger.Instance;
            _atomicProjectionCheckpointManager = atomicProjectionCheckpointManager;
            _persistence    = persistence;
            _commitEnhancer = commitEnhancer;
            _atomicReadmodelProjectorHelperFactory = atomicReadmodelProjectorHelperFactory;
            _lastPositionDispatched = _atomicProjectionCheckpointManager.GetLastPositionDispatched();
            _nStoreLoggerFactory    = nStoreLoggerFactory;
            FlushTimeSpan           = TimeSpan.FromSeconds(30); //flush checkpoint on db each 10 seconds.

            Logger.Info("Created Atomic Projection Engine");
            MaximumDifferenceForCatchupPoller = 20000;

            Metrics.HealthChecks.RegisterHealthCheck("AtomicProjectionEngine", (Func <Metrics.HealthCheckResult>)GetHealthCheck);
        }
Example #11
0
            public PollingObserveCommitsTpl(
                IPersistStreams persistStreams,
                int interval,
                string checkpointToken,
                ICommitEnhancer enhancer,
                bool boost)
            {
                _persistStreams  = persistStreams;
                _checkpointToken = checkpointToken;
                _enhancer        = enhancer;
                _interval        = interval;
                _boost           = boost;

                DataflowBlockOptions bufferOptions = new DataflowBlockOptions();

                if (_boost)
                {
                    bufferOptions.BoundedCapacity = 1000;
                }
                _buffer = new BufferBlock <ICommit>(bufferOptions);

                ExecutionDataflowBlockOptions executionOption = new ExecutionDataflowBlockOptions();

                executionOption.BoundedCapacity        = 1000;
                executionOption.MaxDegreeOfParallelism = 16;
                _enhancerBlock = new TransformBlock <ICommit, ICommit>((Func <ICommit, ICommit>)Enhance, executionOption);

                _subscribers = new ConcurrentDictionary <Guid, ITargetBlock <ICommit> >();

                _broadcaster = GuaranteedDeliveryBroadcastBlock.Create(_subscribers, 1000);

                _buffer.LinkTo(_enhancerBlock, new DataflowLinkOptions()
                {
                    PropagateCompletion = true
                });
                _enhancerBlock.LinkTo(_broadcaster, new DataflowLinkOptions()
                {
                    PropagateCompletion = true
                });
            }
 public PollingClientWrapper(ICommitEnhancer enhancer, bool boost, IConcurrentCheckpointTracker tracker)
 {
     _enhancer = enhancer;
     _boost    = boost;
     _tracker  = tracker;
 }
Example #13
0
 public PollingClientWrapperTpl(ICommitEnhancer enhancer, bool boost)
 {
     _enhancer = enhancer;
     _boost    = boost;
 }