EventStore.Core.Tests.Services.Transport.Http.HttpBootstrap.Subscribe C# (CSharp) Method

Subscribe() public static method

public static Subscribe ( IBus bus, HttpService service ) : void
bus IBus
service HttpService
return void
        public static void Subscribe(IBus bus, HttpService service)
        {
            bus.Subscribe<SystemMessage.SystemInit>(service);
            bus.Subscribe<SystemMessage.BecomeShuttingDown>(service);
            bus.Subscribe<HttpMessage.PurgeTimedOutRequests>(service);
        }

Usage Example

コード例 #1
0
        public void SetUp(Action <IHttpService> bootstrap = null)
        {
            _bus = new InMemoryBus($"bus_{_serverEndPoint.Port}");
            var pipelineBus = InMemoryBus.CreateTest();
            var queue       = new QueuedHandlerThreadPool(pipelineBus, "Test", new QueueStatsManager(), true, TimeSpan.FromMilliseconds(50));

            _multiQueuedHandler = new MultiQueuedHandler(new IQueuedHandler[] { queue }, null);
            _multiQueuedHandler.Start();

            _service = new KestrelHttpService(ServiceAccessibility.Private, _bus, new NaiveUriRouter(),
                                              _multiQueuedHandler, false, null, 0, false, _serverEndPoint);
            _internalDispatcher = new InternalDispatcherEndpoint(queue, _multiQueuedHandler);
            _bus.Subscribe(_internalDispatcher);
            KestrelHttpService.CreateAndSubscribePipeline(pipelineBus);
            bootstrap?.Invoke(_service);
            _server = new TestServer(
                new WebHostBuilder()
                .UseStartup(new ClusterVNodeStartup(Array.Empty <ISubsystem>(), queue, _bus, _multiQueuedHandler,
                                                    new TestAuthenticationProvider(),
                                                    new IHttpAuthenticationProvider[] {
                new BasicHttpAuthenticationProvider(new TestAuthenticationProvider()),
                new AnonymousHttpAuthenticationProvider(),
            }, new TestAuthorizationProvider(), new FakeReadIndex(_ => false), 1024 * 1024, _service)));
            _httpMessageHandler = _server.CreateHandler();
            _client             = new HttpAsyncClient(_timeout, _httpMessageHandler);

            HttpBootstrap.Subscribe(_bus, _service);
        }
All Usage Examples Of EventStore.Core.Tests.Services.Transport.Http.HttpBootstrap::Subscribe