You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tracking sub-issue of #5354. Part of the production-HA acceptance plan (Phase 2, P1).
What this PR changes
Quota accounting gets a release-handle (AutoCloseable) and the gate learns the A2A operation taxonomy. The handler is paired with a try-with-resources block at every call site, so disconnect / cancel / timeout automatically releases the quota slot.
SecurityGate.acquire(RequestContext ctx, Operation op, long units) throws QuotaExceededException returns the handle; the call site uses try (QuotaHandle h = gate.acquire(...)) { ... }. Every existing quotaManager.tryAcquire(...) call site in UniIngressService, UniHttpServer, A2AGatewayHttpHandler, UniAdminServer, and the connector scheduler is converted to the handle form.
A2A operation classification
RequestContext.Operation gains A2A_SUBMIT, A2A_GET, A2A_LIST, A2A_STREAM, A2A_WAIT, A2A_CANCEL. The gate maps them to distinct QuotaManager.Resource buckets:
Operation
Resource
Reason
A2A_SUBMIT
THROUGHPUT
rate-limited like publish
A2A_GET / A2A_LIST
THROUGHPUT
light read traffic
A2A_STREAM
CONNECTIONS
one slot per active SSE/WS
A2A_WAIT
BACKLOG
one slot per pending wait
A2AGatewayHttpHandler builds a distinct RequestContext per operation; the existing single-context-for-all-handlers pattern is split.
Acceptance criteria
QuotaHandle is added with *_check test that asserts close() calls release exactly once.
SecurityGateQuotaHandleTest covers: (a) successful acquire + close releases the slot, (b) acquire throws QuotaExceededException without consuming, (c) double-close is a no-op, (d) A2A_STREAM CONNECTIONS slot is released on SSE disconnect.
Tracking sub-issue of #5354. Part of the production-HA acceptance plan (Phase 2, P1).
What this PR changes
Quota accounting gets a release-handle (AutoCloseable) and the gate learns the A2A operation taxonomy. The handler is paired with a try-with-resources block at every call site, so disconnect / cancel / timeout automatically releases the quota slot.
QuotaHandleAPISecurityGate.acquire(RequestContext ctx, Operation op, long units) throws QuotaExceededExceptionreturns the handle; the call site usestry (QuotaHandle h = gate.acquire(...)) { ... }. Every existingquotaManager.tryAcquire(...)call site inUniIngressService,UniHttpServer,A2AGatewayHttpHandler,UniAdminServer, and the connector scheduler is converted to the handle form.A2A operation classification
RequestContext.OperationgainsA2A_SUBMIT,A2A_GET,A2A_LIST,A2A_STREAM,A2A_WAIT,A2A_CANCEL. The gate maps them to distinctQuotaManager.Resourcebuckets:A2A_SUBMITA2A_GET/A2A_LISTA2A_STREAMA2A_WAITA2AGatewayHttpHandlerbuilds a distinctRequestContextper operation; the existing single-context-for-all-handlers pattern is split.Acceptance criteria
QuotaHandleis added with*_checktest that assertsclose()callsreleaseexactly once.SecurityGateQuotaHandleTestcovers: (a) successful acquire + close releases the slot, (b) acquire throwsQuotaExceededExceptionwithout consuming, (c) double-close is a no-op, (d) A2A_STREAMCONNECTIONSslot is released on SSE disconnect.arch-guardtestruleQuotaRequiresHandle(from [P0] arch-guard: ban raw QuotaManager calls (force release-handle) #5358) is tightened: rawtryAcquireoutside the handle class now fails the build.RouteLevelQuotaTestexercises HTTP publish / A2A submit / A2A stream / legacy TCP / SSE / admin routes end-to-end and asserts the rightResourceis charged per route.Verification
Depends on / blocks
References
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/security/gate/QuotaManager.javaeventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/security/gate/SecurityGate.javaeventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/security/gate/RequestContext.javaeventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/a2a/A2AGatewayHttpHandler.javaPart of the production-HA topology in #5354. See also #5352 and #5353.