Skip to content

mediator: MediatorBuilder and in-process dispatch #6

@pierrick-fonquerne

Description

@pierrick-fonquerne

Implement the mediator that routes commands and queries to their registered handlers through the middleware pipeline.

Scope

  • MediatorBuilder fluent builder: .with_handler(h), .with_middleware(m), .with_middleware_for::<C, M>(m), .verify_handlers(), .build().
  • Mediator with send::<C> and query::<Q> dispatching through the global then per-type middleware chain.
  • Handler registry backed by inventory for compile-time type discovery.
  • build() returns Err when verify_handlers() detects a registered type with no instance.

Acceptance criteria

  • Mediator::builder().with_handler(h).build() dispatches a command to the correct handler.
  • A global middleware executes for every send and query call.
  • A per-type middleware executes only for the targeted command type.
  • build() returns Err(HandlerNotFound) when verify_handlers() is active and an instance is missing.
  • Integration test exercises a full chain: middleware to handler to result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:featureNew capabilityphase:mediatorIn-process dispatch, MediatorBuilder, registry

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions