Skip to main content

Module notify

Module notify 

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

§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 via tokio::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§

BetterStackSubscriber
Subscriber that forwards error events to BetterStack Logs.
EventPublisher
Broadcasts Events to registered EventSubscribers.
FormattedMessage
A formatted message ready to be sent to an external platform.
RetryConfig
Configuration for retry behaviour on outbound HTTP calls.
WebhookSubscriber
Subscriber that POSTs the event as JSON to a webhook URL.

Enums§

Event
A domain event emitted by the ironflow system.

Traits§

EventSubscriber
A subscriber that reacts to domain events.
MessageFormatter
Converts domain events into platform-specific messages.

Functions§

deliver_with_retry
Execute an HTTP request with retry and exponential backoff.
is_accepted_202
Returns true when the response status is exactly 202 Accepted.
is_success_2xx
Returns true when the response status is 2xx.

Type Aliases§

SubscriberFuture
Boxed future returned by EventSubscriber::handle.