예제 #1
0
        private void ReadFromRabbit()
        {
            channel.QueueDeclare(queue: "Dell.SolutionSelling.Metrics.Consumer",
                                 durable: true,
                                 exclusive: false,
                                 autoDelete: false,
                                 arguments: null);

            var consumer = new EventingBasicConsumer(channel);

            consumer.Received += (model, ea) =>
            {
                var body    = ea.Body;
                var message = Encoding.UTF8.GetString(body);
                LogEventTypes.Metrics genmetrics = JsonConvert.DeserializeObject <LogEventTypes.Metrics>(message);
                WriteToElastic(genmetrics);
                Console.WriteLine(" [x] Received {0}", message);
            };

            channel.BasicConsume(queue: "Dell.SolutionSelling.Metrics.Consumer",
                                 noAck: true,
                                 consumer: consumer);
        }
예제 #2
0
 private void WriteToElastic(LogEventTypes.Metrics genmetrics)
 {
     var index = elasticclient.Index(genmetrics);
 }