Introduce engine event proto and replace direct WebSocket pushes from engine
- Dominant language
- Scala
- Stars
- 314
- Forks
- 187
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 214
Description
### Task Summary
Three engine files push WebSocket events by reaching into web's `SessionState.getAllSessionStates.foreach(_.send(...))`:
- `amber/clustering/ClusterListener.scala` — `ClusterStatusUpdateEvent(numWorkerNodesInCluster)`
- `amber/engine/architecture/controller/Controller.scala` — `RegionUpdateEvent(regions)`
- `amber/engine/architecture/scheduling/RegionExecutionCoordinator.scala` — `RegionStateEvent(region.id.id, phase.toString)`
Define an engine-side `.proto` (`amber/src/main/protobuf/org/apache/texera/amber/engine/events/engineevents.proto`) with case classes `ClusterSizeChanged`, `RegionsUpdated`, `RegionPhaseChanged`. Engine code publishes via Pekko `system.eventStream.publish(...)` instead of writing to `SessionState`. A new web-side actor subscribes to those classes and translates each one to the corresponding existing `TexeraWebSocketEvent` subclass (`ClusterStatusUpdateEvent` / `RegionUpdateEvent` / `RegionStateEvent`) before pushing into `SessionState`. The wire format on the WebSocket itself does not change — the JSON contract with the frontend stays as is; only the engine→web hop becomes a typed proto contract.
Part of #5424.
### Task Type
- [x] Refactor / Cleanup
Contributor guide
Assessment
This issue has not been assessed yet.