pub struct ReceivedEvent {
pub topic: String,
pub source: String,
pub entity_id: String,
pub event_type: String,
pub worker_event: Option<WorkerEvent>,
pub timestamp: DateTime<Utc>,
}Expand description
Event received from EventService.
Wraps the raw topic and payload from EventSubscriber and provides parsed fields for handler dispatch. This replaces the duplicate EventEnvelope type in workflow/triggers.rs.
§Topic Format
Topics follow the pattern: {source}.{entity_id}.{event_type}
worker.sandbox123.started- Sandbox started eventworker.container456.stopped- Container stopped event
Fields§
§topic: StringFull topic string (e.g., “worker.sandbox123.started”)
source: StringSource service (e.g., “worker”, “registry”, “model”)
entity_id: StringEntity identifier (e.g., sandbox_id, container_id)
event_type: StringEvent type (e.g., “started”, “stopped”)
worker_event: Option<WorkerEvent>Deserialized worker event (if source is “worker” and payload is valid)
timestamp: DateTime<Utc>Event timestamp
Implementations§
Source§impl ReceivedEvent
impl ReceivedEvent
Sourcepub fn from_message(topic: &str, payload: &[u8]) -> Self
pub fn from_message(topic: &str, payload: &[u8]) -> Self
Create a ReceivedEvent from raw topic and payload.
Parses the topic into components and attempts to deserialize the payload for worker events.
Sourcepub fn matches_pattern(&self, pattern: &str) -> bool
pub fn matches_pattern(&self, pattern: &str) -> bool
Check if this event matches a topic pattern.
Supports prefix matching (e.g., “worker.” matches “worker.abc.started”).
Sourcepub fn extract_inputs(&self) -> HashMap<String, String>
pub fn extract_inputs(&self) -> HashMap<String, String>
Extract inputs for workflow dispatch.
Returns a map of input values extracted from the event payload.
Trait Implementations§
Source§impl Clone for ReceivedEvent
impl Clone for ReceivedEvent
Source§fn clone(&self) -> ReceivedEvent
fn clone(&self) -> ReceivedEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ReceivedEvent
impl RefUnwindSafe for ReceivedEvent
impl Send for ReceivedEvent
impl Sync for ReceivedEvent
impl Unpin for ReceivedEvent
impl UnsafeUnpin for ReceivedEvent
impl UnwindSafe for ReceivedEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more