Exemple #1
0
        public PluginHost()
        {
            XmlConfigurator.Configure();
            var sopWatch = Stopwatch.StartNew();

            log.Debug("Инициализация...");
            InitializeComponent();
            var rabbitmqConfig = RabbitmqConfigurationSection.GetConfiguration();

            processHostManager = new ProcessHostManager(rabbitmqConfig.HostName, rabbitmqConfig.UserName, rabbitmqConfig.Password);
            plugins            = new List <Plugin>();

            using (var dbContext = new OrationiDatabaseContext())
            {
                foreach (var requestCode in dbContext.RequestCodes)
                {
                    log.Debug($"Загрузка синхронного/асинхронного обработчиков для кода запроса \"{requestCode.Id}\"");
                    plugins.AddRange(new[] {
                        new Plugin
                        {
                            RequestCode = requestCode.Id,
                            IsSync      = true
                        },
                        new Plugin
                        {
                            RequestCode = requestCode.Id,
                            IsSync      = false
                        }
                    });
                }
            }
            sopWatch.Stop();
            log.Debug($"Инициализация выполнилась за {sopWatch.Elapsed.TotalSeconds} секунд");
        }
Exemple #2
0
        public RabbitClient()
        {
            var rabbitmqCongig = RabbitmqConfigurationSection.GetConfiguration();

            _hostName = rabbitmqCongig.HostName;
            _userName = rabbitmqCongig.UserName;
            _password = rabbitmqCongig.Password;

            var factory = new ConnectionFactory()
            {
                HostName = _hostName, UserName = _userName, Password = _password
            };

            _connection = factory.CreateConnection();
            _channel    = _connection.CreateModel();

            _correlationId = Guid.NewGuid().ToString();
        }