Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
        private JsonTransportResponse HandleQueryEntityVersionsRequest(JsonTransportRequest request)
        {
            var requestParams = QueryEntityVersionsRequest.FromJArray((JArray)request.Body);
            var response      = _participant.QueryEntityVersions(requestParams);

            return(new JsonTransportResponse(200, response.ToJArray()));
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
        private JsonTransportResponse HandleQueryAggregateDigestsRequest(JsonTransportRequest request)
        {
            var requestParams = QueryAggregateDigestsRequest.FromJObject(request.Body);
            var response      = _participant.QueryAggregateDigests(requestParams);

            return(new JsonTransportResponse(200, response.ToJArray()));
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 6
0
        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)));
        }
Exemplo n.º 7
0
 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");
     }
 }
Exemplo n.º 8
0
        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"));
            }
        }
Exemplo n.º 9
0
 private JsonTransportResponse HandleQueryEntityVersionsRequest(JsonTransportRequest request)
 {
     var requestParams = QueryEntityVersionsRequest.FromJArray((JArray) request.Body);
     var response = _participant.QueryEntityVersions(requestParams);
     return new JsonTransportResponse(200, response.ToJArray());
 }
Exemplo n.º 10
0
 private JsonTransportResponse HandleQueryAggregateDigestsRequest(JsonTransportRequest request)
 {
     var requestParams = QueryAggregateDigestsRequest.FromJObject(request.Body);
     var response = _participant.QueryAggregateDigests(requestParams);
     return new JsonTransportResponse(200, response.ToJArray());
 }
Exemplo n.º 11
0
 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));
 }
Exemplo n.º 12
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);
            }
        }