private JsonTransportResponse HandleActionInvocation(JsonTransportRequest request)
 {
     // TODO un-fudge this DeserializeObject(JContainer.ToString()) nonsense
     var requestParams = JsonConvert.DeserializeObject<ActionInvocation>(request.Body.ToString());
     var response = _participant.Invoke(requestParams);
     return new JsonTransportResponse(200, JObject.FromObject(response));
 }
        private JsonTransportResponse HandleQueryEntityVersionsRequest(JsonTransportRequest request)
        {
            var requestParams = QueryEntityVersionsRequest.FromJArray((JArray)request.Body);
            var response      = _participant.QueryEntityVersions(requestParams);

            return(new JsonTransportResponse(200, response.ToJArray()));
        }
        private JsonTransportResponse HandleRetrieveContent(JsonTransportRequest request)
        {
            var requestParams = JsonConvert.DeserializeObject <EntityContentRequest>(request.Body.ToString());
            var response      = _participant.RetrieveEntityContent(requestParams);

            return(new JsonTransportResponse(200, JObject.FromObject(response)));
        }
        private JsonTransportResponse HandleQueryAggregateDigestsRequest(JsonTransportRequest request)
        {
            var requestParams = QueryAggregateDigestsRequest.FromJObject(request.Body);
            var response      = _participant.QueryAggregateDigests(requestParams);

            return(new JsonTransportResponse(200, response.ToJArray()));
        }
Beispiel #5
0
        private void ReceiveAckHandleReply()
        {
            var message = Receive();

            if (message == null)
            {
                return;
            }
            Ack(message);

            try
            {
                var messageBody = Json.Deserialize(message.Body);
                _log.Debug("Received message: {0}", messageBody);
                var request  = new JsonTransportRequest(EndpointFor(message), messageBody);
                var response = _handler.HandleRequest(request);
                Reply(message, response);
            }
            catch (Exception e)
            {
                var response = JsonTransportResponse.Error(e.Message);
                _log.Error(e);
                Reply(message, response);
            }
        }
        private JsonTransportResponse HandleActionInvocation(JsonTransportRequest request)
        {
            // TODO un-fudge this DeserializeObject(JContainer.ToString()) nonsense
            var requestParams = JsonConvert.DeserializeObject <ActionInvocation>(request.Body.ToString());
            var response      = _participant.Invoke(requestParams);

            return(new JsonTransportResponse(200, JObject.FromObject(response)));
        }
 public JsonTransportResponse HandleRequest(JsonTransportRequest request)
 {
     switch (request.Endpoint)
     {
         case "query_aggregate_digests":
             return HandleQueryAggregateDigestsRequest(request);
         case "query_entity_versions":
             return HandleQueryEntityVersionsRequest(request);
         case "invoke":
             return HandleActionInvocation(request);
         case "retrieve_content":
             return HandleRetrieveContent(request);
         default:
             return JsonTransportResponse.NotFound("Endpoint '"+request.Endpoint+@"' not implemented");
     }
 }
        public JsonTransportResponse HandleRequest(JsonTransportRequest request)
        {
            switch (request.Endpoint)
            {
            case "query_aggregate_digests":
                return(HandleQueryAggregateDigestsRequest(request));

            case "query_entity_versions":
                return(HandleQueryEntityVersionsRequest(request));

            case "invoke":
                return(HandleActionInvocation(request));

            case "retrieve_content":
                return(HandleRetrieveContent(request));

            default:
                return(JsonTransportResponse.NotFound("Endpoint '" + request.Endpoint + @"' not implemented"));
            }
        }
 private JsonTransportResponse HandleQueryEntityVersionsRequest(JsonTransportRequest request)
 {
     var requestParams = QueryEntityVersionsRequest.FromJArray((JArray) request.Body);
     var response = _participant.QueryEntityVersions(requestParams);
     return new JsonTransportResponse(200, response.ToJArray());
 }
 private JsonTransportResponse HandleQueryAggregateDigestsRequest(JsonTransportRequest request)
 {
     var requestParams = QueryAggregateDigestsRequest.FromJObject(request.Body);
     var response = _participant.QueryAggregateDigests(requestParams);
     return new JsonTransportResponse(200, response.ToJArray());
 }
 private JsonTransportResponse HandleRetrieveContent(JsonTransportRequest request)
 {
     var requestParams = JsonConvert.DeserializeObject<EntityContentRequest>(request.Body.ToString());
     var response = _participant.RetrieveEntityContent(requestParams);
     return new JsonTransportResponse(200, JObject.FromObject(response));
 }
        private void ReceiveAckHandleReply()
        {
            var message = Receive();
            if (message == null)
            {
                return;
            }
            Ack(message);

            try
            {
                var messageBody = Json.Deserialize(message.Body);
                _log.Debug("Received message: {0}", messageBody);
                var request = new JsonTransportRequest(EndpointFor(message), messageBody);
                var response = _handler.HandleRequest(request);
                Reply(message, response);
            }
            catch (Exception e)
            {
                var response = JsonTransportResponse.Error(e.Message);
                _log.Error(e);
                Reply(message, response);
            }
        }