当前位置: 首页>>代码示例>>C#>>正文


C# IODispatcher类代码示例

本文整理汇总了C#中IODispatcher的典型用法代码示例。如果您正苦于以下问题:C# IODispatcher类的具体用法?C# IODispatcher怎么用?C# IODispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IODispatcher类属于命名空间,在下文中一共展示了IODispatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: setup

 public void setup()
 {
     _bus = new InMemoryBus("bus");
     _listEventsHandler = new TestHandler<ClientMessage.ReadStreamEventsBackward>();
     _bus.Subscribe(_listEventsHandler);
     _ioDispatcher = new IODispatcher(_bus, new PublishEnvelope(_bus));
     _subscriptionDispatcher =
         new ReaderSubscriptionDispatcher
             (_bus);
     _bus.Subscribe(
         _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
     _bus.Subscribe(
         _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionEofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionMeasured>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.SubscriptionStarted>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ReaderAssignedReader>());
     _bus.Subscribe(_ioDispatcher.BackwardReader);
     _bus.Subscribe(_ioDispatcher.ForwardReader);
     _bus.Subscribe(_ioDispatcher.Writer);
     _bus.Subscribe(_ioDispatcher);
     IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
     _projectionConfig = new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false, false);
     var version = new ProjectionVersion(1, 0, 0);
     var projectionProcessingStrategy = new ContinuousProjectionProcessingStrategy(
         "projection", version, projectionStateHandler, _projectionConfig,
         projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher);
     _coreProjection = projectionProcessingStrategy.Create(
         Guid.NewGuid(), _bus, SystemAccount.Principal, _bus, _ioDispatcher, _subscriptionDispatcher,
         new RealTimeProvider());
     _coreProjection.Start();
 }
开发者ID:msbahrul,项目名称:EventStore,代码行数:35,代码来源:when_starting_a_projection.cs

示例2: CreatePausedEventReader

 public IEventReader CreatePausedEventReader(
     Guid eventReaderId, IPublisher publisher, IODispatcher ioDispatcher, CheckpointTag checkpointTag,
     bool stopOnEof, int? stopAfterNEvents)
 {
     return new AllStreamsCatalogEventReader(
         ioDispatcher, publisher, eventReaderId, _runAs, checkpointTag.CatalogPosition + 1, _timeProvider, stopOnEof: stopOnEof);
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:7,代码来源:ParallelQueryAllStreamsMasterReaderStrategy.cs

示例3: CreateProjectionProcessingPhases

        protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
            IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
            PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
            IProjectionProcessingPhase firstPhase)
        {

            var coreProjectionCheckpointWriter =
                new CoreProjectionCheckpointWriter(
                    namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name);
            var checkpointManager2 = new DefaultCheckpointManager(
                publisher, projectionCorrelationId, _projectionVersion, _projectionConfig.RunAs, ioDispatcher,
                _projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false,
                _sourceDefinition.DefinesFold, coreProjectionCheckpointWriter);

            IProjectionProcessingPhase writeResultsPhase;
            if (GetProducesRunningResults()
                || !string.IsNullOrEmpty(_sourceDefinition.CatalogStream) && _sourceDefinition.ByStreams)
                writeResultsPhase = new WriteQueryEofProjectionProcessingPhase(
                    1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
                    checkpointManager2);
            else
                writeResultsPhase = new WriteQueryResultProjectionProcessingPhase(
                    1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
                    checkpointManager2);

            return new[] {firstPhase, writeResultsPhase};
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:27,代码来源:QueryProcessingStrategy.cs

示例4: CreateProcessingPhases

        public override sealed IProjectionProcessingPhase[] CreateProcessingPhases(
            IPublisher publisher, Guid projectionCorrelationId, PartitionStateCache partitionStateCache,
            Action updateStatistics, CoreProjection coreProjection, ProjectionNamesBuilder namingBuilder,
            ITimeProvider timeProvider, IODispatcher ioDispatcher,
            CoreProjectionCheckpointWriter coreProjectionCheckpointWriter)
        {
            var definesFold = _sourceDefinition.DefinesFold;

            var readerStrategy = CreateReaderStrategy(timeProvider);

            var zeroCheckpointTag = readerStrategy.PositionTagger.MakeZeroCheckpointTag();

            var checkpointManager = CreateCheckpointManager(
                projectionCorrelationId, publisher, ioDispatcher, namingBuilder, coreProjectionCheckpointWriter,
                definesFold, readerStrategy);


            var resultWriter = CreateFirstPhaseResultWriter(
                checkpointManager as IEmittedEventWriter, zeroCheckpointTag, namingBuilder);

            var firstPhase = CreateFirstProcessingPhase(
                publisher, projectionCorrelationId, partitionStateCache, updateStatistics, coreProjection,
                _subscriptionDispatcher, zeroCheckpointTag, checkpointManager, readerStrategy, resultWriter);

            return CreateProjectionProcessingPhases(
                publisher, projectionCorrelationId, namingBuilder, partitionStateCache, coreProjection, ioDispatcher,
                firstPhase);
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:28,代码来源:DefaultProjectionProcessingStrategy.cs

示例5: Setup

 public void Setup()
 {
     _consumer = new TestHandler<Message>();
     _bus = new InMemoryBus("temp");
     _bus.Subscribe(_consumer);
     ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000);
     var ioDispatcher = new IODispatcher(_bus, new PublishEnvelope(_bus));
     _readerService = new EventReaderCoreService(_bus, ioDispatcher, 10, writerCheckpoint, runHeadingReader: true);
     _subscriptionDispatcher =
         new ReaderSubscriptionDispatcher(_bus);
     _spoolProcessingResponseDispatcher = new SpooledStreamReadingDispatcher(_bus);
     _timeoutScheduler = new TimeoutScheduler();
     _workerId = Guid.NewGuid();
     _service = new ProjectionCoreService(
         _workerId, _bus, _bus, _subscriptionDispatcher, new RealTimeProvider(), ioDispatcher,
         _spoolProcessingResponseDispatcher, _timeoutScheduler);
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionEofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionMeasured>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionDeleted>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.SubscriptionStarted>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ReaderAssignedReader>());
     _bus.Subscribe(_spoolProcessingResponseDispatcher.CreateSubscriber<PartitionProcessingResult>());
     _readerService.Handle(new Messages.ReaderCoreServiceMessage.StartReader());
     _service.Handle(new ProjectionCoreServiceMessage.StartCore());
 }
开发者ID:czcz1024,项目名称:EventStore,代码行数:30,代码来源:TestFixtureWithProjectionCoreService.cs

示例6: CreateProjectionProcessingPhases

 protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
     IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
     PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
     IProjectionProcessingPhase firstPhase)
 {
     return new[] {firstPhase};
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:7,代码来源:SlaveQueryProcessingStrategy.cs

示例7: BuildAuthenticationProvider

		public IAuthenticationProvider BuildAuthenticationProvider(IPublisher mainQueue, IBus mainBus, IPublisher workersQueue, InMemoryBus[] workerBusses)
		{
			var passwordHashAlgorithm = new Rfc2898PasswordHashAlgorithm();
			var dispatcher = new IODispatcher(mainQueue, new PublishEnvelope(workersQueue, crossThread: true));
			
			foreach (var bus in workerBusses) {
				bus.Subscribe(dispatcher.ForwardReader);
				bus.Subscribe(dispatcher.BackwardReader);
				bus.Subscribe(dispatcher.Writer);
				bus.Subscribe(dispatcher.StreamDeleter);
				bus.Subscribe(dispatcher);
			}

			// USER MANAGEMENT
			var ioDispatcher = new IODispatcher(mainQueue, new PublishEnvelope(mainQueue));
			mainBus.Subscribe(ioDispatcher.BackwardReader);
			mainBus.Subscribe(ioDispatcher.ForwardReader);
			mainBus.Subscribe(ioDispatcher.Writer);
			mainBus.Subscribe(ioDispatcher.StreamDeleter);
			mainBus.Subscribe(ioDispatcher);

			var userManagement = new UserManagementService(mainQueue, ioDispatcher, passwordHashAlgorithm, skipInitializeStandardUsersCheck: false);
			mainBus.Subscribe<UserManagementMessage.Create>(userManagement);
			mainBus.Subscribe<UserManagementMessage.Update>(userManagement);
			mainBus.Subscribe<UserManagementMessage.Enable>(userManagement);
			mainBus.Subscribe<UserManagementMessage.Disable>(userManagement);
			mainBus.Subscribe<UserManagementMessage.Delete>(userManagement);
			mainBus.Subscribe<UserManagementMessage.ResetPassword>(userManagement);
			mainBus.Subscribe<UserManagementMessage.ChangePassword>(userManagement);
			mainBus.Subscribe<UserManagementMessage.Get>(userManagement);
			mainBus.Subscribe<UserManagementMessage.GetAll>(userManagement);
			mainBus.Subscribe<SystemMessage.BecomeMaster>(userManagement);
			
			return new InternalAuthenticationProvider(dispatcher, passwordHashAlgorithm, ESConsts.CachedPrincipalCount);
		}
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:35,代码来源:InternalAuthenticationProviderFactory.cs

示例8: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            WriterCheckpoint = new InMemoryCheckpoint(0);
            ChaserCheckpoint = new InMemoryCheckpoint(0);

            Bus = new InMemoryBus("bus");
            IODispatcher = new IODispatcher(Bus, new PublishEnvelope(Bus));

            Db = new TFChunkDb(new TFChunkDbConfig(PathName,
                                                   new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                                   10000,
                                                   0,
                                                   WriterCheckpoint,
                                                   ChaserCheckpoint,
                                                   new InMemoryCheckpoint(-1),
                                                   new InMemoryCheckpoint(-1)));

            Db.Open();
            // create db
            Writer = new TFChunkWriter(Db);
            Writer.Open();
            WriteTestScenario();
            Writer.Close();
            Writer = null;

            WriterCheckpoint.Flush();
            ChaserCheckpoint.Write(WriterCheckpoint.Read());
            ChaserCheckpoint.Flush();

            var readers = new ObjectPool<ITransactionFileReader>("Readers", 2, 5, () => new TFChunkReader(Db, Db.Config.WriterCheckpoint));
            var lowHasher = new XXHashUnsafe();
            var highHasher = new Murmur3AUnsafe();
            TableIndex = new TableIndex(GetFilePathFor("index"), lowHasher, highHasher,
                                        () => new HashListMemTable(PTableVersions.Index64Bit, MaxEntriesInMemTable * 2),
                                        () => new TFReaderLease(readers),
                                        PTableVersions.Index64Bit,
                                        MaxEntriesInMemTable);

            ReadIndex = new ReadIndex(new NoopPublisher(),
                                      readers,
                                      TableIndex,
                                      0,
                                      additionalCommitChecks: true,
                                      metastreamMaxCount: MetastreamMaxCount,
                                      hashCollisionReadLimit: Opts.HashCollisionReadLimitDefault);

            ReadIndex.Init(ChaserCheckpoint.Read());

            // scavenge must run after readIndex is built
            if (_scavenge)
            {
                if (_completeLastChunkOnScavenge)
                    Db.Manager.GetChunk(Db.Manager.ChunksCount - 1).Complete();
                _scavenger = new TFChunkScavenger(Db, IODispatcher, TableIndex, ReadIndex, Guid.NewGuid(), "fakeNodeIp");
                _scavenger.Scavenge(alwaysKeepScavenged: true, mergeChunks: _mergeChunks);
            }
        }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:59,代码来源:ReadIndexTestScenario.cs

示例9: CreatePausedEventReader

 public IEventReader CreatePausedEventReader(
     Guid eventReaderId, IPublisher publisher, IODispatcher ioDispatcher, CheckpointTag checkpointTag,
     bool stopOnEof, int? stopAfterNEvents)
 {
     return new ExternallyFedByStreamEventReader(
         publisher, eventReaderId, SystemAccount.Principal, ioDispatcher, checkpointTag.CommitPosition,
         _timeProvider, resolveLinkTos: true);
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:8,代码来源:ExternallyFedReaderStrategy.cs

示例10: CreatePausedEventReader

 public IEventReader CreatePausedEventReader(
     Guid eventReaderId, IPublisher publisher, IODispatcher ioDispatcher, CheckpointTag checkpointTag,
     bool stopOnEof, int? stopAfterNEvents)
 {
     return new StreamEventReader(
         publisher, eventReaderId, _runAs, _catalogStream, checkpointTag.CatalogPosition + 1, _timeProvider,
         resolveLinkTos: true, stopOnEof: stopOnEof, stopAfterNEvents: stopAfterNEvents);
 }
开发者ID:nchistyakov,项目名称:EventStore-1,代码行数:8,代码来源:ParallelQueryMasterReaderStrategy.cs

示例11: CreateProcessingPhases

 public override IProjectionProcessingPhase[] CreateProcessingPhases(
     IPublisher publisher, Guid projectionCorrelationId, PartitionStateCache partitionStateCache,
     Action updateStatistics, CoreProjection coreProjection, ProjectionNamesBuilder namingBuilder,
     ITimeProvider timeProvider, IODispatcher ioDispatcher,
     CoreProjectionCheckpointWriter coreProjectionCheckpointWriter)
 {
     return new IProjectionProcessingPhase[] {_phase1, _phase2};
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:8,代码来源:specification_with_multi_phase_core_projection.cs

示例12: CreateCheckpointManager

 protected override ICoreProjectionCheckpointManager CreateCheckpointManager(
     Guid projectionCorrelationId, IPublisher publisher, IODispatcher ioDispatcher, ProjectionNamesBuilder namingBuilder,
     CoreProjectionCheckpointWriter coreProjectionCheckpointWriter, bool definesFold, IReaderStrategy readerStrategy)
 {
     return new NoopCheckpointManager(
         publisher, projectionCorrelationId, _projectionConfig, _name, readerStrategy.PositionTagger,
         namingBuilder);
 }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:8,代码来源:SlaveQueryProcessingStrategy.cs

示例13: Setup

        public void Setup()
        {
            var fakePublisher = new FakePublisher();
            _ioDispatcher = new IODispatcher(fakePublisher, new PublishEnvelope(fakePublisher));

            _subscriptionDispatcher =
                new ReaderSubscriptionDispatcher(new FakePublisher());
        }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:8,代码来源:when_creating_a_projection.cs

示例14: Setup

        public void Setup()
        {
            //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
            _bus.Subscribe(_consumer);

            _manager = new ProjectionManager(
                GetInputQueue(), GetInputQueue(), GivenCoreQueues(), _timeProvider, RunProjections.All,
                _initializeSystemProjections);

            IPublisher inputQueue = GetInputQueue();
            IPublisher publisher = GetInputQueue();
            var ioDispatcher = new IODispatcher(publisher, new PublishEnvelope(inputQueue));
            _bus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.ResultReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager);
            _bus.Subscribe<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_manager);
            
            _bus.Subscribe<ProjectionManagementMessage.Post>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.UpdateQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetQuery>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Delete>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetStatistics>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetState>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.GetResult>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Disable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Enable>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Abort>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.SetRunAs>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.Reset>(_manager);
            _bus.Subscribe<ProjectionManagementMessage.StartSlaveProjections>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
            _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);

            _bus.Subscribe<ClientMessage.ReadStreamEventsForwardCompleted>(ioDispatcher.ForwardReader);
            _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(ioDispatcher.BackwardReader);
            _bus.Subscribe<ClientMessage.WriteEventsCompleted>(ioDispatcher.Writer);
            _bus.Subscribe<ClientMessage.DeleteStreamCompleted>(ioDispatcher.StreamDeleter);
            _bus.Subscribe<IODispatcherDelayedMessage>(ioDispatcher);

            _awakeReaderService = new AwakeReaderService();
            _bus.Subscribe<StorageMessage.EventCommitted>(_awakeReaderService);
            _bus.Subscribe<StorageMessage.TfEofAtNonCommitRecord>(_awakeReaderService);
            _bus.Subscribe<AwakeReaderServiceMessage.SubscribeAwake>(_awakeReaderService);
            _bus.Subscribe<AwakeReaderServiceMessage.UnsubscribeAwake>(_awakeReaderService);


            Given();
            WhenLoop();
        }
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:57,代码来源:specification_with_projection_management_service.cs

示例15: CoreProjectionCheckpointReader

 public CoreProjectionCheckpointReader(
     IPublisher publisher, Guid projectionCorrelationId, IODispatcher ioDispatcher, string projectionCheckpointStreamId, ProjectionVersion projectionVersion, bool useCheckpoints)
 {
     _publisher = publisher;
     _projectionCorrelationId = projectionCorrelationId;
     _ioDispatcher = ioDispatcher;
     _projectionCheckpointStreamId = projectionCheckpointStreamId;
     _projectionVersion = projectionVersion;
     _useCheckpoints = useCheckpoints;
 }
开发者ID:adbrowne,项目名称:EventStore,代码行数:10,代码来源:CoreProjectionCheckpointReader.cs


注:本文中的IODispatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。