// methods
        public RequestBase GetRequestFromJsonDocument()
        {
            var builder      = new RequestFromJsonBuilder(null);
            var jsonDocument = JsonDocument.Parse(SerializedRequest);

            return(builder.GetRequest(jsonDocument.RootElement));
        }
Esempio n. 2
0
        private void OnCommandReceived(object model, BasicDeliverEventArgs ea)
        {
            var body           = ea.Body.ToArray();
            var requestBuilder = new RequestFromJsonBuilder(null);
            var jsonDocument   = JsonDocument.Parse(body);
            var request        = requestBuilder.GetRequest(jsonDocument.RootElement);
            var command        = requestBuilder.GetCommand(jsonDocument.RootElement.GetProperty("Command"));

            _commandHandler.Handle(request, command);
            _logger.LogInformation($"handled {command.ToString()} command for request with ID {request.ID} at {DateTime.UtcNow}");
        }