Ejemplo n.º 1
0
        private async Task RunImplAsync(CancellationToken stoppingToken)
        {
            var dispatcher = new MessageDispatcher(
                SerializationRegister,
                Monitor,
                MiddlewareMap,
                _loggerFactory,
                MessageBackoffStrategy,
                MessageContextAccessor);

            var subscriptionGroupFactory = new SubscriptionGroupFactory(
                dispatcher,
                Monitor,
                _loggerFactory);

            SubscriptionGroups =
                subscriptionGroupFactory.Create(_defaultSubscriptionGroupSettings,
                                                _subscriptionGroupSettings);

            _log.LogInformation("Starting bus with settings: {@Response}", SubscriptionGroups.Interrogate());

            try
            {
                await SubscriptionGroups.RunAsync(stoppingToken).ConfigureAwait(false);
            }
            catch (OperationCanceledException)
            {
                _log.LogDebug("Suppressed an exception of type {ExceptionType} which likely " +
                              "means the bus is shutting down.", nameof(OperationCanceledException));
                // Don't bubble cancellation up to Completion task
            }
        }
Ejemplo n.º 2
0
        public InterrogationResult Interrogate()
        {
            var publisherDescriptions =
                _publishersByType.Select(publisher =>
                                         publisher.Key.Name).ToArray();

            return(new InterrogationResult(new
            {
                Config.Region,
                Middleware = MiddlewareMap.Interrogate(),
                PublishedMessageTypes = publisherDescriptions,
                SubscriptionGroups = SubscriptionGroups?.Interrogate()
            }));
        }