public static IFlow <R> Map <T, R>(this IFlow <T> source, Func <T, R> mapper) { return(FlowFactory.Flow <R>((collector, cancellationToken) => source.Collect( item => collector.Emit(mapper(item)), cancellationToken ) )); }
public static IFlow <T> OnNext <T>(this IFlow <T> source, Action <T> action) { return(FlowFactory.Flow <T>((collector, cancellationToken) => source.Collect(item => { action(item); collector.Emit(item); }, cancellationToken) )); }
public static IFlow <T> Filter <T>(this IFlow <T> source, Func <T, bool> predicate) { return(FlowFactory.Flow <T>((collector, cancellationToken) => source.Collect(item => { if (predicate(item)) { collector.Emit(item); } }, cancellationToken) )); }
//private static IHostProcess[] _processes; private static void Main(string[] args) { IBuilder flow = FlowFactory.Create() .RunProcess <CreateFileProcess>(new CreateFileWorkItemArguments(DateTime.Now)) .Then().RunProcess <TokenFileProcess>() .Then().RunProcess <MaskFileProcess>() .Then().RunProcess <MapFileProcess>() .Then().RunProcess <SendFileProcess>() .Then().RunProcess <MapSendLogProcess>() .Then().RunProcess <ValidateFileProcess>() .Then().RunProcess <MoveFileProcess>(); flow.Start(1, 3, TimeSpan.FromSeconds(5), NotifyIfBrokenStep); Console.ReadKey(); }
static void Main(string[] args) { using (TransactionScope scope = new TransactionScope()) { try { //启动 Flow flo = FlowFactory.getFlow("key1", "8454"); flo.StartFlow(null, "8454", "4045", "APT0091"); //同意 //Flow flo = FlowFactory.getFlowByTodo(64, "7352"); //Dictionary<string, string> vallist = new Dictionary<string, string>(); //vallist.Add("a","2"); //flo.Operation(vallist, 64, "7352", WF.Common.Operation.Agree, "驳回测试"); scope.Complete(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }
public static IFlow <T> StartFlow <T>(this T obj) { return(FlowFactory.Create(obj)); }