Summary
Add an execution Strategy pattern (SequentialStrategy, ParallelTaskStrategy, DedicatedThreadStrategy) so how a batch is processed can change without touching business code.
Goal
Let processing mode be swapped at runtime (e.g. sequential for debugging, parallel for prod) via a pluggable strategy contract.
Problem
Execution mode is hard-coded in each call. Changing between sequential (debuggable) and parallel requires rewriting call sites.
Scope
Design Expectations
- Thin; resilient; the strategy orchestrates the base primitives.
- Business delegates stay identical regardless of strategy.
- Async-only across strategies.
Acceptance Criteria
Non-Goals
- No
Parallel.ForEach blocking mode.
- No new scheduler/threadpool implementation.
Summary
Add an execution Strategy pattern (
SequentialStrategy,ParallelTaskStrategy,DedicatedThreadStrategy) so how a batch is processed can change without touching business code.Goal
Let processing mode be swapped at runtime (e.g. sequential for debugging, parallel for prod) via a pluggable strategy contract.
Problem
Execution mode is hard-coded in each call. Changing between sequential (debuggable) and parallel requires rewriting call sites.
Scope
IExecutionStrategycontract.SequentialStrategy: run tasks in order.ParallelTaskStrategy: standardTask.WhenAll.DedicatedThreadStrategy: for CPU-heavy work (explicit scheduling).ExecutionOptionsor registration.Design Expectations
Acceptance Criteria
Non-Goals
Parallel.ForEachblocking mode.