public async Task StartAsync(CancellationToken cancellationToken)
        {
            _bus.ConnectReceiveEndpointObserver(_receiveEndpointCheck);

            await _bus.StartAsync(cancellationToken).ConfigureAwait(false);

            _simplifiedBusCheck?.ReportBusStarted();
        }
示例#2
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            _bus.ConnectReceiveEndpointObserver(_receiveEndpointCheck);

            _startTask = _bus.StartAsync(cancellationToken);

            if (_startTask.IsCompleted)
            {
                if (_startTask.IsCompletedSuccessfully())
                {
                    _simplifiedBusCheck?.ReportBusStarted();
                }

                return(_startTask);
            }

            if (_simplifiedBusCheck != null)
            {
                _startTask.ContinueWith(task => _simplifiedBusCheck?.ReportBusStarted(), TaskContinuationOptions.OnlyOnRanToCompletion);
            }

            return(TaskUtil.Completed);
        }