Expand description
Event-driven notification system for the ironflow lifecycle.
Uses a publisher/subscriber pattern: the EventPublisher broadcasts
Events to registered EventSubscribers. Event type filtering
is handled by the publisher at subscription time – subscribers only
receive events they signed up for.
Built-in subscribers:
WebhookSubscriber– POSTs JSON to a URL with retry and exponential backoff.BetterStackSubscriber– forwards error events to BetterStack Logs.
§Architecture
Event– domain event enum covering runs, steps, approvals, auth.EventSubscriber– trait: receives and handles a single event.EventPublisher– holds subscriptions (subscriber + event type filter), dispatches matching events viatokio::spawn.MessageFormatter– trait: converts events into platform-specific messages.RetryConfig– shared retry/backoff configuration for HTTP subscribers.WebhookSubscriber– built-in HTTP POST implementation.
§Examples
use ironflow_engine::notify::{Event, EventPublisher, WebhookSubscriber};
let mut publisher = EventPublisher::new();
publisher.subscribe(
WebhookSubscriber::new("https://hooks.example.com/events"),
&[Event::RUN_STATUS_CHANGED, Event::STEP_FAILED],
);Structs§
- Better
Stack Subscriber - Subscriber that forwards error events to BetterStack Logs.
- Event
Publisher - Broadcasts
Events to registeredEventSubscribers. - Formatted
Message - A formatted message ready to be sent to an external platform.
- Retry
Config - Configuration for retry behaviour on outbound HTTP calls.
- Webhook
Subscriber - Subscriber that POSTs the event as JSON to a webhook URL.
Enums§
- Event
- A domain event emitted by the ironflow system.
Traits§
- Event
Subscriber - A subscriber that reacts to domain events.
- Message
Formatter - Converts domain events into platform-specific messages.
Functions§
- deliver_
with_ retry - Execute an HTTP request with retry and exponential backoff.
- is_
accepted_ 202 - Returns
truewhen the response status is exactly202 Accepted. - is_
success_ 2xx - Returns
truewhen the response status is 2xx.
Type Aliases§
- Subscriber
Future - Boxed future returned by
EventSubscriber::handle.