示例#1
0
        private void CINP(
            ProjectionManagementMessage.Command.StartSlaveProjections message,
            SlaveProjectionDefinitions.Definition @group,
            SlaveProjectionCommunicationChannel[] resultArray,
            int queueIndex,
            int arrayIndex,
            Action completed)
        {
            var projectionCorrelationId = Guid.NewGuid();
            var slaveProjectionName     = message.Name + "-" + @group.Name + "-" + queueIndex;

            _awaitingSlaveProjections.Add(
                projectionCorrelationId,
                assigned =>
            {
                var queueWorkerId = _workers[queueIndex];

                resultArray[arrayIndex] = new SlaveProjectionCommunicationChannel(
                    slaveProjectionName,
                    queueWorkerId,
                    assigned.SubscriptionId);
                completed();

                _awaitingSlaveProjections.Remove(projectionCorrelationId);
            });


            var initializer = new NewProjectionInitializer(
                ProjectionQueryId,
                slaveProjectionName,
                @group.Mode,
                @group.HandlerType,
                @group.Query,
                true,
                @group.EmitEnabled,
                @group.CheckpointsEnabled,
                @group.EnableRunAs,
                @group.TrackEmittedStreams,
                @group.RunAs1,
                replyEnvelope: null);

            initializer.CreateAndInitializeNewProjection(
                this,
                projectionCorrelationId,
                _workers[queueIndex],
                true,
                message.MasterWorkerId,
                message.MasterCorrelationId);
        }
示例#2
0
        private void CINP(
            ProjectionManagementMessage.StartSlaveProjections message, SlaveProjectionDefinitions.Definition @group,
            SlaveProjectionCommunicationChannel[] resultArray, int queueIndex, int arrayIndex, Action completed)
        {
            var projectionCorrelationId = Guid.NewGuid();
            var slaveProjectionName     = message.Name + "-" + @group.Name + "-" + queueIndex;
            var initializer             = new NewProjectionInitializer(
                ProjectionQueryId, slaveProjectionName, @group.Mode, @group.HandlerType, @group.Query, true,
                @group.EmitEnabled, @group.CheckpointsEnabled, @group.EnableRunAs, @group.RunAs);

            initializer.CreateAndInitializeNewProjection(
                this, managedProjection =>
            {
                resultArray[arrayIndex] = new SlaveProjectionCommunicationChannel(
                    slaveProjectionName, projectionCorrelationId, managedProjection.SlaveProjectionSubscriptionId,
                    _queues[queueIndex]);
                completed();
            }, projectionCorrelationId, queueIndex, true, message.ResultsPublisher, message.MasterCorrelationId);
        }