public void ConsumeMessage(BasicDeliverEventArgs message, ConnectionFactory connectionFactory)
        {
            var body            = message.Body;
            var extactedMessage = Encoding.UTF8.GetString(body);

            _logger.LogInformation($"Received message with routing key {message.RoutingKey} exchange :{message.Exchange} & Body:{extactedMessage}");

            switch (message.RoutingKey)
            {
            case "configuration.train":
            {
                //var messageSaved = _accessor.InsertResponse(dataObject);
                //_publisher.Publish(JsonConvert.SerializeObject(dataObject),connectionFactory);
                break;
            }

            case "parser.completed":
            {
                var dataObject   = BsonSerializer.Deserialize <MessageDto>(extactedMessage);
                var messageSaved = _accessor.InsertResponse(dataObject);
                break;
            }

            case "copier.completed":
            {
                _accessor.UpdateMapper(extactedMessage);
                break;
            }

            case "ranker.completed":
            {
                _accessor.UpdateRanker(extactedMessage);
                break;
            }
            }
        }
Beispiel #2
0
        public ActionResult <string> UdpateRanker([FromBody] object message, [FromServices] ConnectionFactory connection)
        {
            var messageSaved = _accessor.UpdateRanker(message.ToString());

            return(Ok(messageSaved));
        }