public Flow_asynchronously() { // Build var async = new Asynchronize<IMessage>(); var throttle = new Throttle_message_flow(); var handle_exception = new Handle_exception(); _processMessage = new Process_message(); Action<IMessage> enqueue = _ => async.Process(_, throttle.Process); // Bind throttle.Continue += handle_exception.Process; handle_exception.Continue += _processMessage.Process; handle_exception.UnhandledException += _ => UnhandledException(_); _process += enqueue; _processMessage.Message += _ => Message(_); _processMessage.Continue += enqueue; _processMessage.Result += _ => Result(_); _processMessage.UnhandledException += _ => UnhandledException(_); _execute += _processMessage.Execute; _start += async.Start; _stop += async.Stop; _throttle += throttle.Delay; }
public Flow_asynchronously(ISchedulingStrategy schedule) { // Build var throttle = new Throttle_message_flow(); var handle_exception = new Handle_exception(); _processMessage = new Process_message(); // Bind _process += schedule.ProcessExternalMessage; schedule.Result += throttle.Process; throttle.Continue += handle_exception.Process; handle_exception.Continue += _processMessage.Process; handle_exception.UnhandledException += _ => UnhandledException(_); _processMessage.Message += _ => Message(_); _processMessage.Continue += schedule.ProcessInternalMessage; _processMessage.Result += _ => Result(_); _processMessage.UnhandledException += _ => UnhandledException(_); _execute += _processMessage.Execute; _start += schedule.Start; _stop += schedule.Stop; _throttle += throttle.Delay; }