Point the Go client at the StreamAlarms alarm feed
Regenerate the Go protobuf stubs and replace the session-scoped QueryActiveAlarms surface with the session-less StreamAlarms feed: snapshot-then-live AlarmFeedMessage fan-out served by the gateway's central alarm monitor. Drops session_id from the acknowledge surface. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,22 +31,24 @@ func (c *Client) AcknowledgeAlarm(ctx context.Context, req *AcknowledgeAlarmRequ
|
||||
return reply, nil
|
||||
}
|
||||
|
||||
// QueryActiveAlarms streams a snapshot of all alarms currently Active or
|
||||
// ActiveAcked — the gateway's ConditionRefresh equivalent. Used after reconnect
|
||||
// to seed local Part 9 state, or to reconcile alarms that may have been missed
|
||||
// during a transport blip.
|
||||
// StreamAlarms attaches to the gateway's central alarm feed. The stream opens
|
||||
// with one AlarmFeedMessage per currently-active alarm (the ConditionRefresh
|
||||
// snapshot), then a single snapshot-complete sentinel, then a transition for
|
||||
// every subsequent raise / acknowledge / clear. It is served by the gateway's
|
||||
// always-on alarm monitor — no worker session is opened — so any number of
|
||||
// clients may attach.
|
||||
//
|
||||
// The returned stream is owned by the caller; cancel ctx to release it.
|
||||
// Optional alarm-reference prefix scoping (req.AlarmFilterPrefix) limits the
|
||||
// stream to a sub-tree.
|
||||
func (c *Client) QueryActiveAlarms(ctx context.Context, req *QueryActiveAlarmsRequest) (QueryActiveAlarmsClient, error) {
|
||||
func (c *Client) StreamAlarms(ctx context.Context, req *StreamAlarmsRequest) (StreamAlarmsClient, error) {
|
||||
if req == nil {
|
||||
return nil, errors.New("mxgateway: query active alarms request is required")
|
||||
return nil, errors.New("mxgateway: stream alarms request is required")
|
||||
}
|
||||
|
||||
stream, err := c.raw.QueryActiveAlarms(ctx, req)
|
||||
stream, err := c.raw.StreamAlarms(ctx, req)
|
||||
if err != nil {
|
||||
return nil, &GatewayError{Op: "query active alarms", Err: err}
|
||||
return nil, &GatewayError{Op: "stream alarms", Err: err}
|
||||
}
|
||||
|
||||
return stream, nil
|
||||
|
||||
Reference in New Issue
Block a user