How asuarezc/asc.utils.commander works
Domain Components
• Command Abstraction: Central to the architecture is the ICommand interface and its implementations (e.g., Command in the Implementation folder). This is the atomic “unit of work” with properties like a unique identifier, parameters, and the actual job (delegate) to execute.
• Command Builder: The ICommandBuilder and its fluent API implementation (e.g., CommandBuilder, CommandBuilderValidator) which help create commands by chaining method calls (setting job, success and failure delegates, and parameters).
• Command Processor: This orchestrates the execution of commands. There are two distinct implementations:
• Sequential Command Processor (SequentialCommandProcessor and its builder)
• Concurrent Command Processor (ConcurrentCommandProcessor and its builder)
• Delegates & Parameter Handling: Elements such as CommandDelegate, CommandParameter, and the ExceptionManager which take care of associated preparation and error handling.
• Commander Singleton: The high-level interface (ICommander) that the client code uses to obtain builders and processors.
• Utility and Validation Components: Supporting classes, validators and configuration objects (e.g., CommandProcessorConfiguration).
Relationships and Data Flow
• A client uses the Commander’s fluent builder methods (for either sequential or concurrent processors) to register pre-job, on-success, on-failure, and post-job delegates.
• The builder then produces a configured ICommandProcessor.
• When a command is created (via the Command Builder), all necessary attributes (identifier, job, success/failure handlers, and parameters) are set.
• The processors (whether sequential or concurrent) receive these command objects and execute the job along with the before/after hooks.
• Error handling is unified through the on-failure delegates which address both specific and generic exceptions.