Functions
send core
fn (event: Event): EventInfo
fn (event-type: Str): EventInfo
fn (event-type: Str, event-data: Any): EventInfo
Publish an event with event-type and event-data. Handlers listening for this event type will be invoked.
Returns an EventInfo containing details about the published event, stream, and environment.
Example
// Publish a user creation event
info send("user:created", {"id": "123", "email": "alice@example.com"})
info.event.id // UUID of the published event
info.event.type // "user:created"
info.event.time // Instant when the event was published
info.stream.id // UUID of the stream
info.env.id // UUID of the environment
// Handler that responds to this event (in another file)
// on-user-created meta {"on-event": "user:created"}
// fn (event) { send-welcome-email(event.data.email) }
Types
Event
fn (event-type: Str, event-data: Any): Event
Event type {
type: Str,
data: Any
}
EventDetail
EventDetail type {
id: Uuid,
type: Str,
time: ::hot::time/Instant
}
EventInfo
EventInfo type {
event: EventDetail,
stream: Stream,
env: Env
}