예제 #1
0
        public static Task <StoredResponse> ExecuteTransaction <TPayload, T>(this IMachineInterfaceConnector <T> connector, string requestId,
                                                                             Func <TPayload, T> getPartitionKey,
                                                                             Func <IMachineInterfaceConnectorMessageSession <TPayload>, Task <StoredResponse> > transaction)
        {
            return(connector.ExecuteTransaction(requestId, async stream =>
            {
                using (var streamReader = new StreamReader(stream))
                    using (var reader = new JsonTextReader(streamReader))
                    {
                        var request = serializer.Deserialize <TPayload>(reader);

                        var partitionKey = getPartitionKey(request);
                        return (request, partitionKey);
                    }
            }, transaction));
        }
예제 #2
0
 public PaymentController(ILogger <PaymentController> logger, IMachineInterfaceConnector <string> connector)
 {
     this.logger    = logger;
     this.connector = connector;
 }