Expand description
Event bus infrastructure — moq-lite backed (#167).
Provides fan-out event delivery between services using the moq-lite streaming plane. Replaces the former ZMQ XPUB/XSUB ProxyService.
§Architecture
Publishers MoqEventOrigin (global) Subscribers
┌─────────────┐ ┌──────────────────────┐ ┌──────────┐
│WorkerService │──moq────►│ local/events/worker │─────►│Workflow- │
│RegistryService│ │ local/events/system │ │ Service │
│ │ │ local/events/registry│ └──────────┘
└─────────────┘ └──────────────────────┘EventPublisher/EventSubscriber are the canonical broadcast types
(EV1, EventService consolidation epic #600) and live in
hyprstream-rpc::events alongside the moq transport and crypto they wire
together. Import them from that canonical module.
Default privacy mode is EventPrivacy::Public (plaintext, wire-identical
to the pre-EV1 behavior of this crate’s old standalone wrapper);
EventPrivacy::ZeroKnowledge/LimitedKnowledge group-key encrypted modes
are also available — see hyprstream_rpc::events docs.
§Usage
ⓘ
use hyprstream_rpc::events::{EventPublisher, EventSubscriber};
// Create a publisher (no ZMQ context needed)
let publisher = EventPublisher::new("worker")?;
publisher.publish("sandbox123", "started", &payload).await?;
// Create a subscriber
let mut subscriber = EventSubscriber::new()?;
subscriber.subscribe("worker.")?;
while let Ok((topic, payload)) = subscriber.recv().await {
println!("Received: {}", topic);
}Re-exports§
pub use token_manager::EventTokenManager;
Modules§
- token_
manager - JWT lifecycle manager for event scope authorization.
Structs§
- Container
Started - Container started event.
- Container
Stopped - Container stopped event.
- Received
Event - Event received from EventService.
- Sandbox
Started - Sandbox started event.
- Sandbox
Stopped - Sandbox stopped event.
Enums§
- Worker
Event - Union of all worker event types.
Functions§
- serialize_
container_ started - Serialize a ContainerStarted event to Cap’n Proto bytes.
- serialize_
container_ stopped - Serialize a ContainerStopped event to Cap’n Proto bytes.
- serialize_
sandbox_ started - Serialize a SandboxStarted event to Cap’n Proto bytes.
- serialize_
sandbox_ stopped - Serialize a SandboxStopped event to Cap’n Proto bytes.