类 MiddlewareChain

java.lang.Object
io.agentscope.core.middleware.MiddlewareChain

public final class MiddlewareChain extends Object
Builds an onion-style middleware chain for a given interception point.

The chain is constructed back-to-front: the last middleware wraps the core logic, and the first middleware is the outermost wrapper.

  • 方法详细资料

    • build

      public static <I> Function<I,reactor.core.publisher.Flux<AgentEvent>> build(List<? extends MiddlewareBase> middlewares, Agent agent, RuntimeContext ctx, MiddlewareChain.MiddlewareMethod<I> method, Function<I,reactor.core.publisher.Flux<AgentEvent>> core)
      Build a middleware chain that produces Flux<AgentEvent>.
      类型参数:
      I - the input type for the interception point
      参数:
      middlewares - ordered list of middlewares (first = outermost)
      agent - the agent instance passed to each middleware
      ctx - per-call runtime context passed to each middleware
      method - reference to the middleware hook method
      core - the innermost logic to execute when all middlewares delegate
      返回:
      a function that, when applied to an input, runs the full chain