• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# InMemoryBus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setup

        public void setup()
        {
            _checkpointUnhandledBytesThreshold = 1000;
            _checkpointProcessedEventsThreshold = 2000;
            Given();
            _bus = new InMemoryBus("bus");
            _projectionCorrelationId = Guid.NewGuid();
            _eventHandler = new TestHandler<EventReaderSubscriptionMessage.CommittedEventReceived>();
            _checkpointHandler = new TestHandler<EventReaderSubscriptionMessage.CheckpointSuggested>();
            _progressHandler = new TestHandler<EventReaderSubscriptionMessage.ProgressChanged>();
            _subscriptionStartedHandler = new TestHandler<EventReaderSubscriptionMessage.SubscriptionStarted>();
            _notAuthorizedHandler = new TestHandler<EventReaderSubscriptionMessage.NotAuthorized>();
            _eofHandler = new TestHandler<EventReaderSubscriptionMessage.EofReached>();
            _partitionEofHandler = new TestHandler<EventReaderSubscriptionMessage.PartitionEofReached>();
            _partitionMeasuredHandler = new TestHandler<EventReaderSubscriptionMessage.PartitionMeasured>();

            _bus.Subscribe(_eventHandler);
            _bus.Subscribe(_checkpointHandler);
            _bus.Subscribe(_progressHandler);
            _bus.Subscribe(_eofHandler);
            _bus.Subscribe(_partitionEofHandler);
            _bus.Subscribe(_partitionMeasuredHandler);
            _readerStrategy = CreateCheckpointStrategy();
            _subscription = CreateProjectionSubscription();


            When();
        }
开发者ID:msbahrul,项目名称:EventStore,代码行数:28,代码来源:TestFixtureWithProjectionSubscription.cs


示例2: Projections

 public Projections(
     TFChunkDb db, QueuedHandler mainQueue, InMemoryBus mainBus, TimerService timerService,
     HttpService httpService, int projectionWorkerThreadCount)
 {
     _projectionWorkerThreadCount = projectionWorkerThreadCount;
     SetupMessaging(db, mainQueue, mainBus, timerService, httpService);
 }
开发者ID:soto,项目名称:EventStore,代码行数:7,代码来源:Projections.cs


示例3: Init

        public virtual void Init()
        {
            var sendOverHttpHandler = GetSendOverHttpProcessor();

            for (int i = 0; i < InstancesCnt; ++i)
            {
                var inputBus = new InMemoryBus(string.Format("ELECTIONS-INPUT-BUS-{0}", i));
                var outputBus = new InMemoryBus(string.Format("ELECTIONS-OUTPUT-BUS-{0}", i));
                var endPoint = new IPEndPoint(BaseEndPoint.Address, BaseEndPoint.Port + i);
                var nodeInfo = new VNodeInfo(Guid.NewGuid(), endPoint, endPoint, endPoint, endPoint, endPoint, endPoint);
                _instances.Add(new ElectionsInstance(nodeInfo.InstanceId, endPoint, inputBus, outputBus));

                sendOverHttpHandler.RegisterEndPoint(endPoint, inputBus);

                var electionsService = new Core.Services.ElectionsService(outputBus,
                                                                             nodeInfo,
                                                                             InstancesCnt,
                                                                             new InMemoryCheckpoint(),
                                                                             new InMemoryCheckpoint(),
                                                                             new FakeEpochManager(),
                                                                             () => -1, 0);
                electionsService.SubscribeMessages(inputBus);

                outputBus.Subscribe(sendOverHttpHandler);
                outputBus.Subscribe(new TimerMessageProcessor(Rnd,
                                                              Runner,
                                                              endPoint,
                                                              inputBus,
                                                              _timerMinDelay,
                                                              _timerMaxDelay));
                outputBus.Subscribe(new InnerBusMessagesProcessor(Runner, endPoint, inputBus));
            }
        }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:33,代码来源:RandomizedElectionsTestCase.cs


示例4: Main

        static void Main(string[] args)
        {
            var outputBus = new InMemoryBus("OutputBus");
            var controller = new NodeController(outputBus);
            var mainQueue = new QueuedHandler(controller, "Main Queue");
            controller.SetMainQueue(mainQueue);

            // Hello world service
            var hello = new HelloWorldService(mainQueue);
            outputBus.Subscribe<SystemMessage.SystemInit>(hello);
            outputBus.Subscribe<SystemMessage.StartShutdown>(hello);
            outputBus.Subscribe<HelloWorldMessage.Hi>(hello);

            // TIMER
            var timer = new TimerService(new ThreadBasedScheduler(new RealTimeProvider()));
            outputBus.Subscribe<TimerMessage.Schedule>(timer);

            Console.WriteLine("Starting everything. Press enter to initiate shutdown");

            mainQueue.Start();

            mainQueue.Publish(new SystemMessage.SystemInit());
            Console.ReadLine();
            mainQueue.Publish(new SystemMessage.StartShutdown());
            Console.ReadLine();
        }
开发者ID:abdullin,项目名称:seda-homework,代码行数:26,代码来源:Program.cs


示例5: setup

 public void setup()
 {
     _bus = new InMemoryBus("bus");
     _listEventsHandler = new TestHandler<ClientMessage.ReadStreamEventsBackward>();
     _bus.Subscribe(_listEventsHandler);
     _readDispatcher = new RequestResponseDispatcher
         <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>(
         _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus));
     _writeDispatcher = new RequestResponseDispatcher<ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>(
         _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus));
     _subscriptionDispatcher =
         new PublishSubscribeDispatcher
             <ReaderSubscriptionManagement.Subscribe,
                 ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage>
             (_bus, v => v.SubscriptionId, v => v.SubscriptionId);
     _bus.Subscribe(
         _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
     _bus.Subscribe(
         _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
     _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());
     _bus.Subscribe(_readDispatcher);
     _bus.Subscribe(_writeDispatcher);
     IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
     _projectionConfig = new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false);
     _coreProjection = CoreProjection.CreateAndPrepare(
         "projection", new ProjectionVersion(1, 0, 0), Guid.NewGuid(), _bus, projectionStateHandler, _projectionConfig, _readDispatcher,
         _writeDispatcher, _subscriptionDispatcher, null, new RealTimeProvider());
     _coreProjection.Start();
 }
开发者ID:jjvdangelo,项目名称:EventStore,代码行数:31,代码来源:when_starting_a_projection.cs


示例6: 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


示例7: ProjectionManagerNode

 private ProjectionManagerNode(IPublisher inputQueue, IPublisher[] queues, RunProjections runProjections)
 {
     _runProjections = runProjections;
     _output = new InMemoryBus("ProjectionManagerOutput");
     _projectionManager = new ProjectionManager(
         inputQueue, _output, queues, new RealTimeProvider(), runProjections);
 }
开发者ID:jjoergensen,项目名称:EventStore,代码行数:7,代码来源:ProjectionManagerNode.cs


示例8: 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


示例9: 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


示例10: 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


示例11: Setup

 public void Setup()
 {
     _consumer = new WatchingConsumer();
     _bus = new InMemoryBus("temp");
     _bus.Subscribe(_consumer);
     _service = new ProjectionCoreService(_bus, _bus, 10, new InMemoryCheckpoint(1000));
     _service.Handle(new ProjectionMessage.CoreService.Start());
 }
开发者ID:soto,项目名称:EventStore,代码行数:8,代码来源:TestFixtureWithProjectionCoreService.cs


示例12: ProjectionWorkerNode

        public ProjectionWorkerNode(TFChunkDb db, QueuedHandler inputQueue)
        {
            Ensure.NotNull(db, "db");

            _coreOutput = new InMemoryBus("Core Output");

            _projectionCoreService = new ProjectionCoreService(CoreOutput, inputQueue, 10, db.Config.WriterCheckpoint);
        }
开发者ID:robashton,项目名称:EventStore,代码行数:8,代码来源:ProjectionWorkerNode.cs


示例13: SetUp

        public void SetUp()
        {
            _bus = new InMemoryBus(string.Format("bus_{0}", _serverEndPoint.Port));

            _service = new HttpService(ServiceAccessibility.Private, _bus, 1, _serverEndPoint.ToHttpUrl());
            _client = new HttpAsyncClient();

            HttpBootstrap.Subscribe(_bus, _service);
        }
开发者ID:base31,项目名称:geteventstore_EventStore,代码行数:9,代码来源:PortableServer.cs


示例14: should_publish_message_to_subscribers

 public void should_publish_message_to_subscribers() {
   var bus = new InMemoryBus();
   bool subscriber_called = false;
   bus.Subscribe(Handlers.Runnable<MyMessage>(msg => {
     Assert.That(msg.Message, Is.EqualTo("MyMessage"));
     subscriber_called = true;
   }));
   bus.Publish(new MyMessage {Message = "MyMessage"});
   Assert.That(subscriber_called, Is.EqualTo(true));
 }
开发者ID:joethinh,项目名称:nohros-must,代码行数:10,代码来源:InMemoryBusTests.cs


示例15: should_unsubscrible

 public void should_unsubscrible() {
   var bus = new InMemoryBus();
   bool subscriber_called = false;
   var handler =
     Handlers.Runnable<MyMessage>(msg => { subscriber_called = true; });
   bus.Subscribe(handler);
   bus.Unsubscribe(handler);
   bus.Publish(new MyMessage {Message = "MyMessage"});
   Assert.That(subscriber_called, Is.EqualTo(false));
 }
开发者ID:joethinh,项目名称:nohros-must,代码行数:10,代码来源:InMemoryBusTests.cs


示例16: setup

 public void setup()
 {
     _bus = new InMemoryBus("bus");
     _listEventsHandler = new TestMessageHandler<ClientMessage.ReadEventsBackwards>();
     _bus.Subscribe(_listEventsHandler);
     _coreProjection = new CoreProjection(
         "projection", Guid.NewGuid(), _bus, new FakeProjectionStateHandler(),
         new ProjectionConfig(ProjectionMode.AdHoc, 5, 10, 1000, 250, true, true, true));
     _coreProjection.Start();
 }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:10,代码来源:when_starting_a_projection.cs


示例17: it_can_be_created

 public void it_can_be_created()
 {
     var coreProjection = new FakeCoreProjection();
     var stateCache = new PartitionStateCache();
     var bus = new InMemoryBus("test");
     var fakeCheckpointManager = new specification_with_multi_phase_core_projection.FakeCheckpointManager(bus, Guid.NewGuid());
     var it = new WriteQueryResultProjectionProcessingPhase(
         1, "result-stream", coreProjection, stateCache,
         fakeCheckpointManager, fakeCheckpointManager);
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:10,代码来源:creating.cs


示例18: TestFixtureSetUp

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

            _db = new TFChunkDb(new TFChunkDbConfig(PathName,
                                                    new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                                    16 * 1024,
                                                    0,
                                                    new InMemoryCheckpoint(),
                                                    new InMemoryCheckpoint(),
                                                    new InMemoryCheckpoint(-1),
                                                    new InMemoryCheckpoint(-1)));
            _db.Open();
            
            var chunk = _db.Manager.GetChunkFor(0);

            _p1 = LogRecord.SingleWrite(0, Guid.NewGuid(), Guid.NewGuid(), "es-to-scavenge", ExpectedVersion.Any, "et1",
                                          new byte[] { 0, 1, 2 }, new byte[] { 5, 7 });
            _res1 = chunk.TryAppend(_p1);

            _c1 = LogRecord.Commit(_res1.NewPosition, Guid.NewGuid(), _p1.LogPosition, 0);
            _cres1 = chunk.TryAppend(_c1);

            _p2 = LogRecord.SingleWrite(_cres1.NewPosition,
                                        Guid.NewGuid(), Guid.NewGuid(), "es-to-scavenge", ExpectedVersion.Any, "et1",
                                        new byte[] { 0, 1, 2 }, new byte[] { 5, 7 });
            _res2 = chunk.TryAppend(_p2);

            _c2 = LogRecord.Commit(_res2.NewPosition, Guid.NewGuid(), _p2.LogPosition, 1);
            _cres2 = chunk.TryAppend(_c2);
            
            _p3 = LogRecord.SingleWrite(_cres2.NewPosition,
                                        Guid.NewGuid(), Guid.NewGuid(), "es-to-scavenge", ExpectedVersion.Any, "et1",
                                        new byte[] { 0, 1, 2 }, new byte[] { 5, 7 });
            _res3 = chunk.TryAppend(_p3);

            _c3 = LogRecord.Commit(_res3.NewPosition, Guid.NewGuid(), _p3.LogPosition, 2);
            _cres3 = chunk.TryAppend(_c3);

            chunk.Complete();

            _db.Config.WriterCheckpoint.Write(chunk.ChunkHeader.ChunkEndPosition);
            _db.Config.WriterCheckpoint.Flush();
            _db.Config.ChaserCheckpoint.Write(chunk.ChunkHeader.ChunkEndPosition);
            _db.Config.ChaserCheckpoint.Flush();

            var bus = new InMemoryBus("Bus");
            var ioDispatcher = new IODispatcher(bus, new PublishEnvelope(bus));
            var scavenger = new TFChunkScavenger(_db, ioDispatcher, new FakeTableIndex(),
                                                 new FakeReadIndex(x => x == "es-to-scavenge"), Guid.NewGuid(), "fakeNodeIp");
            scavenger.Scavenge(alwaysKeepScavenged: true, mergeChunks: false);

            _scavengedChunk = _db.Manager.GetChunk(0);
        }
开发者ID:SzymonPobiega,项目名称:EventStore,代码行数:54,代码来源:when_having_scavenged_tfchunk_with_all_records_removed.cs


示例19: setup0

 public void setup0()
 {
     _bus = new InMemoryBus("bus");
     _readDispatcher =
         new RequestResponseDispatcher
             <ClientMessage.ReadEventsBackwards, ClientMessage.ReadEventsBackwardsCompleted>(
             _bus, e => e.CorrelationId, e => e.CorrelationId);
     _writeDispatcher =
         new RequestResponseDispatcher<ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>(
             _bus, e => e.CorrelationId, e => e.CorrelationId);
 }
开发者ID:vishal-h,项目名称:EventStore-1,代码行数:11,代码来源:TestFixtureWithReadWriteDisaptchers.cs


示例20: SetUp

 public void SetUp()
 {
     _stateCache = GivenStateCache();
     _publisher = new InMemoryBus("test");
     _coreProjection = new FakeCoreProjection();
     _checkpointManager = new specification_with_multi_phase_core_projection.FakeCheckpointManager(
         _publisher, Guid.NewGuid());
     _resultStreamName = "result-stream";
     _phase = new WriteQueryResultProjectionProcessingPhase(
         1, _resultStreamName, _coreProjection, _stateCache, _checkpointManager, _checkpointManager);
     When();
 }
开发者ID:thinkbeforecoding,项目名称:EventStore,代码行数:12,代码来源:creating.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InMemoryRavenConfiguration类代码示例发布时间:2022-05-24
下一篇:
C# InMemoryAdapter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap