Exemplo n.º 1
0
        internal void UpdateConfiguration(HystrixRabbitMQServiceInfo si, HystrixProviderConnectorOptions configuration)
        {
            if (si == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(si.Uri))
            {
                if (si.Scheme.Equals(HystrixProviderConnectorOptions.Default_SSLScheme, System.StringComparison.OrdinalIgnoreCase))
                {
                    configuration.SslEnabled = true;
                    configuration.SslPort    = si.Port;
                }
                else
                {
                    configuration.Port = si.Port;
                }

                configuration.Username    = si.UserName;
                configuration.Password    = si.Password;
                configuration.Server      = si.Host;
                configuration.VirtualHost = si.Path;
            }
        }
        private static void DoAdd(IServiceCollection services, HystrixRabbitMQServiceInfo info, IConfiguration config, ServiceLifetime contextLifetime)
        {
            var rabbitFactory = RabbitMQTypeLocator.ConnectionFactory;
            var hystrixConfig = new HystrixProviderConnectorOptions(config);
            var factory       = new HystrixProviderConnectorFactory(info, hystrixConfig, rabbitFactory);

            services.Add(new ServiceDescriptor(typeof(HystrixConnectionFactory), factory.Create, contextLifetime));
        }
 public HystrixProviderConnectorFactory(HystrixRabbitMQServiceInfo sinfo, HystrixProviderConnectorOptions config, Type connectFactory)
 {
     _info   = sinfo;
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _type   = connectFactory ?? throw new ArgumentNullException(nameof(connectFactory));
     _setUri = FindSetUriMethod(_type);
     if (_setUri == null)
     {
         throw new ConnectorException("Unable to find ConnectionFactory.SetUri(), incompatible RabbitMQ assembly");
     }
 }
Exemplo n.º 4
0
 internal string Configure(HystrixRabbitMQServiceInfo si, HystrixProviderConnectorOptions configuration)
 {
     UpdateConfiguration(si, configuration);
     return(configuration.ToString());
 }