Option <ReadOnlyList <CommandSubmission <TSpec> > > ICommandSubmitter.Submit <TSpec>(IEnumerable <TSpec> commands, SystemNode target, CorrelationToken?ct) { var submissions = MutableList.Create <CommandSubmission <TSpec> >(); foreach (var command in commands) { var submission = CommandSubmission.Create(command, NextSubmissionId(), C.Service <IJsonSerializer>().ObjectToJson(command), ct, now()); SubmissionQueue.Enqueue(submission); submissions.Add(submission); } return(ReadOnlyList.Create(submissions)); }
Option <ReadOnlyList <CommandSubmission <TSpec> > > ICommandQueue <TSpec> .Enqueue(IEnumerable <TSpec> commands, SystemNode target, CorrelationToken?ct) => Enqueue(commands, target, ct) .Map(x => x.Map(y => CommandSubmission.Create(y.Spec, y.SubmissionId, y.CommandJson, y.CorrelationToken, y.EnqueuedTime)));