Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="config"></param>
 public RabbitMQBusService(RabbitMQConfig config)
 {
     _factory = new RabbitMQBusFactory
     {
         Config = config ?? throw new ArgumentNullException(nameof(config)),
                        ConnectionFactory = new ConnectionFactory
                        {
                            AutomaticRecoveryEnabled = config.AutomaticRecoveryEnabled,
                            NetworkRecoveryInterval  = config.NetworkRecoveryInterval,
                            Uri = new Uri(config.ConnectionString)
                        }
     };
     _factory.TryConnect();
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="config"></param>
 /// <param name="serviceProvider"></param>
 public RabbitMQBusService(IServiceProvider serviceProvider, RabbitMQConfig config)
 {
     _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(config));
     _config          = config ?? throw new ArgumentNullException(nameof(config));
     _factory         = new RabbitMQBusFactory
     {
         ConnectionFactory = new ConnectionFactory
         {
             AutomaticRecoveryEnabled = config.AutomaticRecoveryEnabled,
             NetworkRecoveryInterval  = config.NetworkRecoveryInterval,
             Uri = new Uri(config.ConnectionString)
         }
     };
     _factory.GetConnection = _factory.ConnectionFactory.CreateConnection();
 }