Skip to content

core: Middleware pipeline (Middleware, Next, MessageEnvelope) #5

@pierrick-fonquerne

Description

@pierrick-fonquerne

Provide the extension point that lets users and built-in components intercept every dispatch without coupling to the handler type.

Scope

  • MessageEnvelope carrying type_name, MessageId and CorrelationId for middleware inspection.
  • BoxOutput type alias (Box<dyn Any + Send + Sync>) for type-erased handler output inside the pipeline.
  • Next<'a> opaque struct wrapping the remainder of the middleware chain.
  • Middleware async trait via trait_variant::make(Send) receiving (&MessageEnvelope, &HandlerContext, Next).

Acceptance criteria

  • A custom middleware that logs before and after dispatch compiles and executes correctly.
  • Next::run propagates HexeractError from the inner handler unchanged.
  • A middleware short-circuiting without calling next.run returns its own error without panicking.
  • cargo clippy -p hexeract-core -- -D warnings passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:featureNew capabilityphase:corePrimitive types, traits and middleware pipeline of hexeract-core

    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