Skip to content

[Architecture Review][P0] Decouple eventmesh-runtime responsibilities via internal packages #5297

Description

@qqeasonchen

Execution meta — see plan: #5296

Problem

eventmesh-runtime carries too many responsibilities and couples the core delivery path too tightly to infrastructure. A single module currently bundles:

  • core delivery logic (UniRuntime, UniIngressService, ReliableDispatcher);
  • HTTP / SSE / WebSocket servers;
  • Nacos cluster metadata;
  • RocksDB offset store;
  • protocol plugin assembly;
  • Connector scheduling;
  • session / agent capabilities.

For example, EventMeshApplication directly creates NacosMetaStore, RocksDBOffsetStore, and the HTTP/WS servers, then assembles the Runtime. eventmesh-runtime/build.gradle also depends directly on Netty, RocksDB, Nacos, and concrete protocol implementations.

Risks

  • The Runtime core cannot be embedded, unit-tested, or swapped easily.
  • Any protocol or infrastructure change can ripple into the core delivery path.
  • The module's claimed "minimal dependency surface" does not match its real dependencies.

Proposed direction

Keep eventmesh-runtime as a single module, but enforce an internal package partition — no new modules, since the module count is already too high:

org.apache.eventmesh.runtime.engine      core delivery: UniRuntime / UniIngressService
org.apache.eventmesh.runtime.bootstrap   configuration reading + assembly only
org.apache.eventmesh.runtime.http        HTTP / SSE / WS servers
org.apache.eventmesh.runtime.state       RocksDB-backed state (behind interfaces)
org.apache.eventmesh.runtime.meta        Nacos-backed meta (behind interfaces)
  • UniRuntime / UniIngressService depend only on interfaces (OffsetStore, MetaStore, PushChannel, MeshStoragePlugin); the concrete NacosMetaStore / RocksDBOffsetStore / Netty implementations live in their own packages.
  • EventMeshApplication only reads configuration and wires components; it must not host core business decisions.
  • Enforce the package boundaries with an ArchUnit rule (see [Architecture Review][P2] Gradle dependency guardrails (architectureCheck) #5305) rather than Gradle module boundaries.

A physical module split is not required at this stage — it is a follow-up only if hard compile-time isolation is needed later.

Acceptance criteria

  • UniRuntime / UniIngressService have no compile-time dependency on Netty, RocksDB, Nacos, or a concrete protocol plugin.
  • The engine package can be unit-tested without starting an HTTP server or Meta store.
  • bootstrap has no delivery logic.
  • An ArchUnit package-dependency rule (from [Architecture Review][P2] Gradle dependency guardrails (architectureCheck) #5305) blocks enginehttp / state / meta imports.

Part of the Architecture Review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementImprove the mechanism or performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions