feat(events): distinguish ResourceExhausted causes with an mxgw-reason trailer (mxaccessgw#216)
Event-queue overflow, alarm-feed overflow, subscriber cap, session limit and oversized commands all surfaced as ResourceExhausted. The status code is unchanged; the gateway now attaches a machine-readable `mxgw-reason` trailer (constants in Contracts ResourceExhaustedReasons). The .NET client maps ResourceExhausted to MxGatewayResourceExhaustedException (an MxGatewayException subclass; additive) exposing Reason/IsOverflow/ IsSubscriberLimit. Documented in docs/ClientBehaviorFixtures.md; the other clients get a doc note only. Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -324,6 +324,11 @@ public sealed class GatewayEndToEndMultiSubscriberTests(ITestOutputHelper output
|
||||
// EventSubscriberLimitReached contains "maximum".
|
||||
Assert.Contains("maximum", capException.Status.Detail, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
// #216: the machine-readable reason distinguishes the cap from an event-queue overflow.
|
||||
Assert.Equal(
|
||||
ResourceExhaustedReasons.SubscriberLimit,
|
||||
capException.Trailers.GetValue(ResourceExhaustedReasons.TrailerKey));
|
||||
|
||||
// The first two streams must still be live (not completed).
|
||||
Assert.False(stream1Task.IsCompleted, "Sub1 must still be streaming after sub3 was rejected.");
|
||||
Assert.False(stream2Task.IsCompleted, "Sub2 must still be streaming after sub3 was rejected.");
|
||||
|
||||
Reference in New Issue
Block a user