mmids_core/reactors/mod.rs
1//! Reactors are actors that are used to manage workflows for specific stream names. This is a
2//! pull mechanism for dynamic workflow capabilities in mmids. When a reactor is asked for a
3//! workflow for a stream name, the reactor will reach out to an external service (configured
4//! by a reactor executor) to obtain a workflow definition for the requested stream name. If none
5//! is returned then that normally means the stream name is not allowed. If a valid workflow
6//! definition is returned, the reactor will ensure that the workflow is created so media can be
7//! routed to it.
8
9pub mod executors;
10pub mod manager;
11mod reactor;
12
13use std::collections::HashMap;
14use std::time::Duration;
15
16pub use reactor::{start_reactor, ReactorRequest, ReactorWorkflowUpdate};
17
18/// How reactors are defined
19#[derive(Clone, Debug)]
20pub struct ReactorDefinition {
21 /// The name of the reactor. Used by endpoints and workflow steps to identify which workflow
22 /// they want to interact with.
23 pub name: String,
24
25 /// The name of the query executor this reactor should use to perform queries
26 pub executor: String,
27
28 /// How many seconds the reactor should wait before it re-runs the executor and gets the latest
29 /// version of the corresponding workflow definition. An update interval of 0 (or a value not
30 /// specified) means it will never update.
31 pub update_interval: Duration,
32
33 /// Key value pairs used to instruct the reactor's executor. Valid values here are specific
34 /// to the executor that was picked.
35 pub parameters: HashMap<String, Option<String>>,
36}