Skip to content

[Context]: add execution strategies (Sequential/Parallel/DedicatedThread) #21

Description

@rian-be

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

  • IExecutionStrategy contract.
  • SequentialStrategy: run tasks in order.
  • ParallelTaskStrategy: standard Task.WhenAll.
  • DedicatedThreadStrategy: for CPU-heavy work (explicit scheduling).
  • Strategy selected via ExecutionOptions or registration.
  • Unit tests: switching strategy changes none of the application code.

Design Expectations

  • Thin; resilient; the strategy orchestrates the base primitives.
  • Business delegates stay identical regardless of strategy.
  • Async-only across strategies.

Acceptance Criteria

  • Swappable strategy without call-site changes.
  • Sequential yields deterministic order; parallel yields completion-speed results.
  • Applies uniformly to batch/map under use-case.

Non-Goals

  • No Parallel.ForEach blocking mode.
  • No new scheduler/threadpool implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    concurrencyParallel / batch / async executionenhancementNew feature or requestextensionExtension behaviors / helpers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions