예제 #1
0
        public virtual async Task Start(CancellationToken cancellationToken = default)
        {
            _received = new BusTestReceiveObserver(TestInactivityTimeout);
            _received.ConnectInactivityObserver(InactivityObserver);

            _consumed = new BusTestConsumeObserver(TestTimeout, InactivityToken);
            _consumed.ConnectInactivityObserver(InactivityObserver);

            _published = new BusTestPublishObserver(TestTimeout, TestInactivityTimeout, InactivityToken);
            _published.ConnectInactivityObserver(InactivityObserver);

            _sent = new BusTestSendObserver(TestTimeout, TestInactivityTimeout, InactivityToken);
            _sent.ConnectInactivityObserver(InactivityObserver);

            PreCreateBus?.Invoke(this);

            BusControl = CreateBus();

            ConnectObservers(BusControl);

            _busHandle = await BusControl.StartAsync(cancellationToken).ConfigureAwait(false);

            BusSendEndpoint = await GetSendEndpoint(BusControl.Address).ConfigureAwait(false);

            InputQueueSendEndpoint = await GetSendEndpoint(InputQueueAddress).ConfigureAwait(false);

            InputQueueSendEndpoint.ConnectSendObserver(_sent);

            BusControl.ConnectConsumeObserver(_consumed);
            BusControl.ConnectPublishObserver(_published);
            BusControl.ConnectReceiveObserver(_received);
            BusControl.ConnectSendObserver(_sent);
        }
예제 #2
0
        public virtual async Task Start()
        {
            _sent      = new TestSendObserver(TestTimeout);
            _consumed  = new BusTestConsumeObserver(TestTimeout);
            _published = new BusTestPublishObserver(TestTimeout);

            PreCreateBus?.Invoke(this);

            _bus = CreateBus();

            ConnectObservers(_bus);

            _busHandle = await _bus.StartAsync().ConfigureAwait(false);

            BusSendEndpoint = await GetSendEndpoint(_bus.Address).ConfigureAwait(false);

            InputQueueSendEndpoint = await GetSendEndpoint(InputQueueAddress).ConfigureAwait(false);

            _inputQueueSendObserver = InputQueueSendEndpoint.ConnectSendObserver(_sent);

            _busConsumeObserver = _bus.ConnectConsumeObserver(_consumed);

            _busPublishObserver = _bus.ConnectPublishObserver(_published);

            _busSendObserver = _bus.ConnectSendObserver(_sent);
        }