示例#1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ConsumersHealthCheckService" /> class.
        /// </summary>
        /// <param name="brokerCollection">
        ///     The collection containing the available brokers.
        /// </param>
        /// <param name="applicationLifetime">
        ///     The <see cref="IHostApplicationLifetime" /> used to track the application shutdown.
        /// </param>
        public ConsumersHealthCheckService(
            IBrokerCollection brokerCollection,
            IHostApplicationLifetime applicationLifetime)
        {
            _brokerCollection = Check.NotNull(brokerCollection, nameof(brokerCollection));
            Check.NotNull(applicationLifetime, nameof(applicationLifetime));

            applicationLifetime.ApplicationStopping.Register(() => _applicationIsStopping = true);
        }
示例#2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="OutboundEndpointsHealthCheckService" /> class.
 /// </summary>
 /// <param name="outboundRoutingConfiguration">
 ///     The <see cref="IOutboundRoutingConfiguration" /> to be used to retrieve the list of outbound
 ///     endpoints.
 /// </param>
 /// <param name="brokerCollection">
 ///     The collection containing the available brokers.
 /// </param>
 /// <param name="serviceProvider">
 ///     The <see cref="IServiceProvider" />.
 /// </param>
 public OutboundEndpointsHealthCheckService(
     IOutboundRoutingConfiguration outboundRoutingConfiguration,
     IBrokerCollection brokerCollection,
     IServiceProvider serviceProvider)
 {
     _outboundRoutingConfiguration = Check.NotNull(
         outboundRoutingConfiguration,
         nameof(outboundRoutingConfiguration));
     _brokerCollection = Check.NotNull(brokerCollection, nameof(brokerCollection));
     _serviceProvider  = Check.NotNull(serviceProvider, nameof(serviceProvider));
 }
        private static void PreloadProducer(
            IBrokerCollection brokers,
            IProducerEndpoint endpoint,
            ISilverbackLogger logger)
        {
            if (!endpoint.IsValid(logger))
            {
                return;
            }

            brokers.GetProducer(endpoint);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="BrokerConnectorService" /> class.
 /// </summary>
 /// <param name="serviceScopeFactory">
 ///     The <see cref="IServiceScopeFactory" />.
 /// </param>
 /// <param name="applicationLifetime">
 ///     The <see cref="IApplicationLifetime" />.
 /// </param>
 /// <param name="brokersCollection">
 ///     The <see cref="IBrokerCollection" />.
 /// </param>
 /// <param name="connectionOptions">
 ///     The <see cref="BrokerConnectionOptions" />.
 /// </param>
 /// <param name="logger">
 ///     The <see cref="ISilverbackLogger" />.
 /// </param>
 public BrokerConnectorService(
     IServiceScopeFactory serviceScopeFactory,
     IHostApplicationLifetime applicationLifetime,
     IBrokerCollection brokersCollection,
     BrokerConnectionOptions connectionOptions,
     ISilverbackLogger <BrokerConnectorService> logger)
 {
     _serviceScopeFactory = Check.NotNull(serviceScopeFactory, nameof(serviceScopeFactory));
     _applicationLifetime = Check.NotNull(applicationLifetime, nameof(applicationLifetime));
     _brokerCollection    = Check.NotNull(brokersCollection, nameof(brokersCollection));
     _connectionOptions   = Check.NotNull(connectionOptions, nameof(connectionOptions));
     _logger = Check.NotNull(logger, nameof(logger));
 }
示例#5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="OutboxWorker" /> class.
 /// </summary>
 /// <param name="serviceScopeFactory">
 ///     The <see cref="IServiceScopeFactory" /> used to resolve the scoped types.
 /// </param>
 /// <param name="brokerCollection">
 ///     The collection containing the available brokers.
 /// </param>
 /// <param name="routingConfiguration">
 ///     The configured outbound routes.
 /// </param>
 /// <param name="logger">
 ///     The <see cref="IOutboundLogger{TCategoryName}" />.
 /// </param>
 /// <param name="enforceMessageOrder">
 ///     Specifies whether the messages must be produced in the same order as they were added to the queue.
 ///     If set to <c>true</c> the message order will be ensured, retrying the same message until it can be
 ///     successfully
 ///     produced.
 /// </param>
 /// <param name="batchSize">
 ///     The number of messages to be loaded and processed at once.
 /// </param>
 public OutboxWorker(
     IServiceScopeFactory serviceScopeFactory,
     IBrokerCollection brokerCollection,
     IOutboundRoutingConfiguration routingConfiguration,
     IOutboundLogger <OutboxWorker> logger,
     bool enforceMessageOrder,
     int batchSize)
 {
     _serviceScopeFactory = serviceScopeFactory;
     _brokerCollection    = brokerCollection;
     _logger = logger;
     _enforceMessageOrder  = enforceMessageOrder;
     _batchSize            = batchSize;
     _routingConfiguration = routingConfiguration;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConsumersHealthCheckService" /> class.
 /// </summary>
 /// <param name="brokerCollection">
 ///     The collection containing the available brokers.
 /// </param>
 public ConsumersHealthCheckService(IBrokerCollection brokerCollection)
 {
     _brokerCollection = brokerCollection;
 }
 public DefaultProduceStrategyImplementation(IBrokerCollection brokerCollection)
 {
     _brokerCollection = brokerCollection;
 }
示例#8
0
 public ConsumersWatcher(IBrokerCollection brokers, ILogger <ConsumersWatcher> logger)
 {
     _brokers = brokers;
     _logger  = logger;
 }