qqeasonchen opened a new pull request, #5310: URL: https://github.com/apache/eventmesh/pull/5310
# Sub-PR A: Control-plane store SPI + deprecate zombie code (issue #5301) This is the first of four sub-PRs that deliver [issue #5301](https://github.com/apache/eventmesh/issues/5301) ("Unified state control-plane stores"). Sub-PR A adds the SPI surface, adapts two existing implementations to it, and deprecates three zombie-code classes that the new architecture will eventually replace. It does **not** change runtime behavior: nothing currently calls the new interfaces yet (call sites move over in Sub-PRs B and C). ## What's in this PR ### New public interfaces (in `org.apache.eventmesh.runtime.state`) | Interface | Backed by (target) | Purpose | |--------------------|------------------------------------------------|------------------------------------------------------| | `SubscriptionStore`| Meta prefix-watch + local cache | Cluster-shared subscription registry | | `SessionStore` | Meta prefix-watch + local cache | Cluster-shared agent / binding / session registry | | `DeadLetterStore` | Meta CAS (idempotent) | Durable ledger of dead-lettered deliveries | | `TaskStore` | Meta CAS + epoch-protected status transitions | A2A task state (with TTL via `expireStale`) | `OffsetStore` and `DeliveryStateStore` are intentionally not added in this PR — they are introduced in Sub-PRs B and C with the actual storage backends. ### Adapted implementations - `ClusterSubscriptionStore` now `implements SubscriptionStore`. `remove(...)` returns the boolean result from `Meta.delete(...)` so callers can detect when a subscription was already gone (idempotent teardown). - `SessionRegistry` now `implements SessionStore`. `register/markReady/ unregister` are renamed to `registerAgent/markAgentReady/unregisterAgent` to match the interface contract (no callers existed in the current tree for the old names). ### Zombie code marked `@Deprecated(forRemoval = true)` Pending [issue #5309](https://github.com/apache/eventmesh/issues/5309) ("PARTITION_OWNED_PULL delivery topology"): - `cluster.PartitionOwnership` — only callable from the second delivery mode the closed #5300 originally enabled; will return as part of #5309. - `cluster.ClusterCoordinator` — superseded by the new Meta CAS path. - `cluster.MetaBackedOffsetStore` — superseded by the `OffsetStore` in Sub-PR B. ### Unit tests `SubscriptionStoreTest` (5), `SessionStoreTest` (6), `DeadLetterStoreTest` (2), `TaskStoreTest` (3) — total **16 tests**, all in-process with hand- rolled test doubles (no Nacos/RocksDB/Testcontainers needed). They pin the SPI contract so subsequent sub-PRs can build on it. ## Out of scope (handled in follow-up sub-PRs) - **Sub-PR B** — `DeliveryStateStore` (RocksDB) + `OffsetStore` (Meta async flush); wire `DeliveryStateStore` into the new consumer path. - **Sub-PR C** — `DeadLetterStore` Meta-backed implementation + `TaskStore` Meta-backed implementation; wire A2A `TaskRegistry` over `TaskStore`. - **Sub-PR D** — fault-injection Testcontainers E2E covering partition transfer, Meta outage, DLQ replay, and TaskStore epoch conflict. ## Open questions for the maintainer (Inherited from the #5301 issue body — please review there.) 1. Should `DeadLetterStore.recordDeadLetter` carry a `dlqOffset` (current design), or just the `dlqTopic` so the offset is derived? 2. Should `TaskStore.TaskRecord` carry full `input` / `output` payloads, or only a `payloadRef` that points to a separate blob store? 3. For `SubscriptionStore.put`, do we want a separate `putIfAbsent` variant to make subscription reconciliation idempotent without overwriting? 4. Should the `SessionStore` interface include a `Watch` / `Subscription` callback hook (similar to Nacos `Listener`) so callers can react to session-state changes without polling? ## Testing This PR was developed on the uni-runtime branch (`develop` at `7260581`). The full `eventmesh-runtime:compileJava` plus the four new test classes pass locally with JDK 21 + Gradle 8.7. Upstream CI will be the source of truth — if anything in the SPI needs to change, the four sub-PRs are independent so a fix here will not block B/C/D. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
