Skip to main content

Module events

Module events 

Source
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§

ContainerStarted
Container started event.
ContainerStopped
Container stopped event.
ReceivedEvent
Event received from EventService.
SandboxStarted
Sandbox started event.
SandboxStopped
Sandbox stopped event.

Enums§

WorkerEvent
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.