Skip to content

SignalR Notification Contract

SignalR notification contract

The Deck использует SignalR как real-time notification layer. SignalR - не source of truth; source of truth - SQL storage. SignalR сообщает connected dashboards, что что-то изменилось и какие UI areas нужно refresh или update.

Где это находится

Runtime typeRole
IChokaQNotifierRuntime notification contract.
ChokaQSignalRNotifierSignalR implementation, отправляющая events clients.
ChokaQHubBidirectional hub для dashboard commands и live updates.

Events

EventMeaning
JobUpdatedActive job status changed.
JobProgressHandler reported progress.
JobArchivedJob moved to successful history.
JobFailedJob moved to DLQ.
JobResurrectedDLQ job moved back to active work.
JobsPurgedJobs were permanently deleted.
QueueStateChangedQueue pause/resume changed.
StatsUpdatedDashboard counters should refresh.

Correctness boundary

SignalR messages могут задерживаться, теряться при disconnects или наблюдаться browser'ом out of order. Это допустимо, потому что dashboard всегда может reload authoritative state from storage.

Event contract нужно рассматривать как UI invalidation protocol, а не durable event stream.

Архитектурное решение

Почему этот pattern?

Operators нужен low-latency feedback, когда jobs move, fail, resurrect или purge. SignalR подходит для interactive dashboard updates без добавления отдельного broker.

Trade-offs

SignalR требует connected clients и authorization на hub. Он не заменяет storage reads или metrics. Dashboard code должен tolerate reconnects и refresh from storage.

Рассмотренные альтернативы

AlternativeBenefitCost
Polling onlyПросто и robust.Медленнее operator feedback и больше periodic reads.
External pub/subВозможен durable fanout.Extra infrastructure для dashboard invalidation.
Browser refresh onlyMinimal code.Poor incident workflow.

Дополнительные вопросы

SignalR authoritative?
Нет. SQL authoritative. SignalR - notification и invalidation layer.

Что если client пропустит event?
Следующий refresh или explicit storage query вернет authoritative state.

Почему не broker?
Для dashboard invalidation SignalR достаточно, и он не добавляет infrastructure.

Лицензия Apache 2.0