using System; namespace ZB.MOM.WW.MxGateway.Worker.MxAccess; public sealed class WorkerRuntimeHeartbeatSnapshot { /// Initializes a new instance of the class. /// Timestamp of the last STA thread activity in UTC. /// Number of commands awaiting processing. /// Current depth of the worker event queue. /// Sequence number of the most recent event. /// Correlation ID of the in-flight command. /// /// True while an STA call outside the command dispatcher is executing (currently the alarm poll). The watchdog treats this like an in-flight command: it suppresses the stale-STA fault /// up to the stuck ceiling instead of the shorter grace, so a healthy-but-slow poll does not fault /// a healthy session. Named generically so any future non-dispatcher STA work reuses it. /// public WorkerRuntimeHeartbeatSnapshot( DateTimeOffset lastStaActivityUtc, uint pendingCommandCount, uint outboundEventQueueDepth, ulong lastEventSequence, string currentCommandCorrelationId, bool staCallInProgress = false) { LastStaActivityUtc = lastStaActivityUtc; PendingCommandCount = pendingCommandCount; OutboundEventQueueDepth = outboundEventQueueDepth; LastEventSequence = lastEventSequence; CurrentCommandCorrelationId = currentCommandCorrelationId ?? string.Empty; StaCallInProgress = staCallInProgress; } /// Gets the last STA activity timestamp in UTC. public DateTimeOffset LastStaActivityUtc { get; } /// Gets the pending command count. public uint PendingCommandCount { get; } /// Gets the current depth of the worker event queue. public uint OutboundEventQueueDepth { get; } /// Gets the sequence number of the most recent event. public ulong LastEventSequence { get; } /// Gets the correlation ID of the in-flight command. public string CurrentCommandCorrelationId { get; } /// /// Gets a value indicating whether an STA call outside the command dispatcher (the alarm poll) is /// executing. When true the watchdog grants the poll the same grace-to-ceiling suppression as a /// dispatched command. /// public bool StaCallInProgress { get; } }