/// <summary>
        /// CookedRabbit RabbitTopologyService constructor. Allows for the sharing of a channel pool and connection pool.
        /// </summary>
        /// <param name="rabbitSeasoning"></param>
        /// <param name="rchanp"></param>
        /// <param name="rconp"></param>
        /// <param name="logger"></param>
        public RabbitMaintenanceService(RabbitSeasoning rabbitSeasoning,
                                        IRabbitChannelPool rchanp,
                                        IRabbitConnectionPool rconp,
                                        ILogger logger = null) : base(rabbitSeasoning, rchanp, rconp, logger)
        {
            Guard.AgainstNull(rabbitSeasoning, nameof(rabbitSeasoning));
            Guard.AgainstNull(rchanp, nameof(rchanp));
            Guard.AgainstNull(rconp, nameof(rconp));

            _logger    = logger;
            _seasoning = rabbitSeasoning;

            rchanp.SetConnectionPoolAsync(rabbitSeasoning, rconp).GetAwaiter().GetResult();
            _rcp = rchanp;

            if (_seasoning.MaintenanceSettings.EnablePingPong)
            {
                _pingPong = PingPongAsync($"{_seasoning.MaintenanceSettings.PingPongQueueName}.{RandomString(5, 10)}", _cancellationTokenSource.Token);
            }

            if (_seasoning.MaintenanceSettings.ApiSettings.RabbitApiAccessEnabled)
            {
                var credentials = new NetworkCredential(
                    _seasoning.MaintenanceSettings.ApiSettings.RabbitApiUserName,
                    _seasoning.MaintenanceSettings.ApiSettings.RabbitApiUserPassword);

                _httpClient = CreateHttpClient(credentials, TimeSpan.FromSeconds(_seasoning.MaintenanceSettings.ApiSettings.RabbitApiTimeout));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// CookedRabbit RabbitTopologyService constructor. Allows for the sharing of a channel pool and connection pool.
        /// </summary>
        /// <param name="rabbitSeasoning"></param>
        /// <param name="rchanp"></param>
        /// <param name="rconp"></param>
        /// <param name="logger"></param>
        public RabbitTopologyService(RabbitSeasoning rabbitSeasoning, IRabbitChannelPool rchanp, IRabbitConnectionPool rconp, ILogger logger = null)
        {
            _logger    = logger;
            _seasoning = rabbitSeasoning;

            rchanp.SetConnectionPoolAsync(rabbitSeasoning, rconp).GetAwaiter().GetResult();

            _rcp = rchanp;
        }
        /// <summary>
        /// CookedRabbit RabbitSerializeService constructor. Allows for the sharing of a channel pool and connection pool.
        /// </summary>
        /// <param name="rabbitSeasoning"></param>
        /// <param name="rchanp"></param>
        /// <param name="rconp"></param>
        /// <param name="logger"></param>
        public RabbitSerializeService(RabbitSeasoning rabbitSeasoning, IRabbitChannelPool rchanp, IRabbitConnectionPool rconp, ILogger logger = null) : base(rabbitSeasoning, rchanp, rconp, logger)
        {
            Guard.AgainstNull(rabbitSeasoning, nameof(rabbitSeasoning));
            Guard.AgainstNull(rchanp, nameof(rchanp));
            Guard.AgainstNull(rconp, nameof(rconp));

            _logger    = logger;
            _seasoning = rabbitSeasoning;

            rchanp.SetConnectionPoolAsync(rabbitSeasoning, rconp).GetAwaiter().GetResult();

            _rcp = rchanp;
        }