Exemple #1
0
        public LogService([FromServices] Dto.RabbitMQConfigurations configurations)
        {
            var factory = new ConnectionFactory()
            {
                HostName = configurations.HostName,
                Port     = configurations.Port
            };

            var connection = factory.CreateConnection();

            _channel = connection.CreateModel();

            _channel.QueueDeclare(queue: "logQueue",
                                  durable: false,
                                  exclusive: false,
                                  autoDelete: false,
                                  arguments: null);
        }
Exemple #2
0
        public LogMiddleware(RequestDelegate next, [FromServices] Dto.RabbitMQConfigurations configurations)
        {
            _next = next;

            var factory = new ConnectionFactory()
            {
                HostName = configurations.HostName,
                Port     = configurations.Port,
                UserName = configurations.UserName,
                Password = configurations.Password
            };

            var connection = factory.CreateConnection();

            _channel = connection.CreateModel();

            _channel.QueueDeclare(queue: "logQueue",
                                  durable: false,
                                  exclusive: false,
                                  autoDelete: false,
                                  arguments: null);
        }