private static void ConfigureBindingBroker(ConfigurationPublisherServer configurationPublisher) { _channel.ExchangeDeclare(configurationPublisher.ExchageName, configurationPublisher.ExchangeType); _channel.QueueDeclare(queue: configurationPublisher.QueueConfiguration.QueueName, durable: configurationPublisher.QueueConfiguration.Durable, exclusive: configurationPublisher.QueueConfiguration.Exclusive, autoDelete: configurationPublisher.QueueConfiguration.AutoDelete, arguments: configurationPublisher.QueueConfiguration.Arguments); _channel.QueueBind(queue: configurationPublisher.QueueConfiguration.QueueName, exchange: configurationPublisher.ExchageName, routingKey: configurationPublisher.KeyBinding); }
public void CreateConfiguration() { _factory = new ConnectionFactory() { HostName = this.hostName, UserName = this.userName, Password = this.password }; _connection = _factory.CreateConnection(); _channel = _connection.CreateModel(); var optionsBuilder = new DbContextOptionsBuilder <ExternalConsultingContext>(); optionsBuilder.UseSqlite("data source=ExternalConsulting.db"); using (var context = new ExternalConsultingContext(optionsBuilder.Options)) { _configurationPublishers = context.ConfigurationPublishers.ToList(); foreach (var configurationPublisher in _configurationPublishers) { ConfigurationPublisherServer publisher = new ConfigurationPublisherServer { ExchageName = configurationPublisher.ExchageName, ExchangeType = configurationPublisher.ExchangeType, QueueConfiguration = new Queue { QueueName = configurationPublisher.QueueName, Durable = true, Exclusive = false, AutoDelete = false, Arguments = null }, KeyBinding = configurationPublisher.KeyBinding }; ConfigureBindingBroker(publisher); } } }