public static Option <CommandSubmission> Submit(this ICommandPatternSystem CPS, ICommandSpec Command, SystemNode DstNode, CorrelationToken?ct) => CPS.Submit(array(Command), DstNode, ct).Map(x => x.FirstOrDefault());
/// <summary> /// Executes an arbitrary number of commands /// </summary> /// <param name="CPS">The command system</param> /// <param name="Commands">The command specifications to execute</param> /// <returns></returns> public static IEnumerable <IOption> ExecuteCommands(this ICommandPatternSystem CPS, params ICommandSpec[] Commands) => map(Commands, spec => CPS.ExecuteCommand(spec));
public static Option <CommandSubmission <TSpec> > Submit <TSpec>(this ICommandPatternSystem CPS, TSpec Command, SystemNode DstNode, CorrelationToken?ct) where TSpec : CommandSpec <TSpec>, new() => CPS.Submit(array(Command), DstNode, ct).Map(x => x.FirstOrDefault());
public static Option <int> SaveSpecs(this ICommandPatternSystem CPS, IEnumerable <ICommandSpec> Commands) => CPS.SaveSpecs(Commands.ToArray());
public CommandProcessor(ICommandPatternSystem CPS, int?BatchSize = null, bool?Concurrent = null) { this.CPS = CPS; this.Concurrent = Concurrent ?? false; this.BatchSize = BatchSize ?? 1; }
public static ICommandProcessor <TSpec, TPayload> Create <TSpec, TPayload>(ICommandPatternSystem CPS, int?BatchSize = null, bool?Concurrent = null) where TSpec : CommandSpec <TSpec, TPayload>, new() => new CommandProcessor <TSpec, TPayload>(CPS, BatchSize, Concurrent);
public static ICommandProcessor Create(ICommandPatternSystem CPS, int?BatchSize = null, bool?Concurrent = null) => new CommandProcessor(CPS, BatchSize, Concurrent);