reactive_graph_reactive_service_api/
reactive_instance_event_manager.rs

1use async_trait::async_trait;
2use springtime_di::injectable;
3
4use crate::ReactiveInstanceEvent;
5use crate::ReactiveInstanceEventTypes;
6use reactive_graph_lifecycle::Lifecycle;
7use reactive_graph_reactive_model_impl::ReactiveEntity;
8
9pub const REACTIVE_INSTANCE_EVENT_PROPERTY_LABEL: &str = "label";
10
11#[injectable]
12#[async_trait]
13pub trait ReactiveInstanceEventManager: Send + Sync + Lifecycle {
14    /// Emits a system event.
15    fn emit_event(&self, event: ReactiveInstanceEvent);
16
17    /// Returns reactive entity instances which can be subscribed to listen for system events.
18    fn get_reactive_instance_event_instances(&self) -> Vec<ReactiveEntity>;
19
20    /// Returns the reactive entity instance which can be subscribed to listen for the given system event.
21    fn get_reactive_instance_event_instance(&self, event_type: ReactiveInstanceEventTypes) -> Option<ReactiveEntity>;
22}