public SpoolStreamProcessingWorkItem(
     ISpoolStreamWorkItemContainer container, IResultWriter resultWriter,
     ParallelProcessingLoadBalancer loadBalancer, EventReaderSubscriptionMessage.CommittedEventReceived message,
     SlaveProjectionCommunicationChannels slaves,
     SpooledStreamReadingDispatcher spoolProcessingResponseDispatcher, long limitingCommitPosition,
     Guid subscriptionId, Guid correlationId, bool definesCatalogTransform)
     : base(Guid.NewGuid())
 {
     if (resultWriter == null)
     {
         throw new ArgumentNullException("resultWriter");
     }
     if (slaves == null)
     {
         throw new ArgumentNullException("slaves");
     }
     if (spoolProcessingResponseDispatcher == null)
     {
         throw new ArgumentNullException("spoolProcessingResponseDispatcher");
     }
     _container    = container;
     _resultWriter = resultWriter;
     _loadBalancer = loadBalancer;
     _message      = message;
     _slaves       = slaves;
     _spoolProcessingResponseDispatcher = spoolProcessingResponseDispatcher;
     _limitingCommitPosition            = limitingCommitPosition;
     _subscriptionId          = subscriptionId;
     _correlationId           = correlationId;
     _definesCatalogTransform = definesCatalogTransform;
 }
Esempio n. 2
0
        public override void AssignSlaves(SlaveProjectionCommunicationChannels slaveProjections)
        {
            _slaves = slaveProjections;
            var workerCount = _slaves.Channels["slave"].Length;

            _loadBalancer = new ParallelProcessingLoadBalancer(
                workerCount, _maxScheduledSizePerWorker, _maxUnmeasuredTasksPerWorker);
        }
Esempio n. 3
0
 private void StopSlaveProjections()
 {
     if (_masterProjectionResponseReader != null)
         _masterProjectionResponseReader.Stop();
     //TODO: encapsulate into StopSlaveProjections message?
     var slaveProjections = _slaveProjections;
     if (slaveProjections != null) {
         _slaveProjections = null;
         foreach (var group in slaveProjections.Channels) {
             foreach (var channel in group.Value) {
                 _publisher.Publish(
                     new ProjectionManagementMessage.Command.Delete(
                         new NoopEnvelope(), channel.ManagedProjectionName,
                         ProjectionManagementMessage.RunAs.System, true, true, false));
             }
         }
     }
 }
Esempio n. 4
0
        protected override void Given()
        {
            _spoolProcessingResponseDispatcher = new SpooledStreamReadingDispatcher(GetInputQueue());

            _bus.Subscribe(_spoolProcessingResponseDispatcher.CreateSubscriber <PartitionProcessingResult>());

            _masterProjectionId = Guid.NewGuid();
            _slave1             = Guid.NewGuid();
            _slave2             = Guid.NewGuid();

            _checkpointHandledThreshold        = 10;
            _checkpointUnhandledBytesThreshold = 10000;

            _configureBuilderByQuerySource = source =>
            {
                source.FromCatalogStream("catalog");
                source.AllEvents();
                source.SetOutputState();
                source.SetByStream();
            };
            _slaveProjections =
                new SlaveProjectionCommunicationChannels(
                    new Dictionary <string, SlaveProjectionCommunicationChannel[]>
            {
                {
                    "slave",
                    new[]
                    {
                        new SlaveProjectionCommunicationChannel(
                            "s1",
                            _workerId,
                            _slave1),
                        new SlaveProjectionCommunicationChannel(
                            "s2",
                            _workerId,
                            _slave2)
                    }
                }
            });

            TicksAreHandledImmediately();
            AllWritesSucceed();
            NoOtherStreams();
        }
 public virtual void AssignSlaves(SlaveProjectionCommunicationChannels slaveProjections)
 {
     throw new NotSupportedException();
 }
Esempio n. 6
0
 public void Handle(ProjectionManagementMessage.SlaveProjectionsStarted message)
 {
     _slaveProjections = message.SlaveProjections;
     GoToState(State.LoadStateRequested);
 }
Esempio n. 7
0
 public void AssignSlaves(SlaveProjectionCommunicationChannels slaveProjections)
 {
     throw new NotImplementedException();
 }
 protected override void Given()
 {
     base.Given();
     _slaveProjections = null;
 }
 public void AssignSlaves(SlaveProjectionCommunicationChannels slaveProjections)
 {
     // intentionally ignored
 }