internal static DataStoreRequest Create(List<object> events, string journalName, TransactionUID transactionUID, RequestUID requestUID, WorkerUID workerUID) { var request = new CommitTransactionPreRequest(events, journalName, transactionUID); var header = new Header(RequestType.COMMIT_TRANSACTION, 0, requestUID, HeaderProperties.None, workerUID); return new DataStoreRequest(header, request); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <param name="body"></param> private void ProcessCommitTransaction(DataStoreRequest request, CommitTransactionPreRequest body) { // Convert hte partial request body into serialized versions of it var types = new HashSet<String>(); var events = new List<String>(); foreach (var evt in body.Events) { var typeNames = evt.GetType().GetInterfaces().Select(it => { return it.Name; }); foreach (var typeName in typeNames) types.Add(typeName); events.Add(serializer.ConvertToString(evt)); } var newRequest = CommitTransactionRequest.Create(events, types.ToList(), body.JournalName, request.Header.RequestUID, body.TransactionUID, request.Header.WorkerUID); newRequest.Write(writer); writer.Flush(); }