pub struct SupervisedExecutor { /* private fields */ }Expand description
Executes routing functions in supervised, isolated processes.
Each invocation runs in its own supervised process. A panic is contained and
returned as FunctionError::Crashed; a function that runs past the
supervision timeout is abandoned and returns FunctionError::TimedOut.
Neither outcome affects the execution of any other channel’s functions.
Implementations§
Source§impl SupervisedExecutor
impl SupervisedExecutor
Sourcepub const DEFAULT_TIMEOUT: Duration
pub const DEFAULT_TIMEOUT: Duration
Default supervision timeout applied by SupervisedExecutor::with_default_timeout.
Sourcepub const fn new(scheduler: Arc<Scheduler>, timeout: Duration) -> Self
pub const fn new(scheduler: Arc<Scheduler>, timeout: Duration) -> Self
Creates an executor with the given supervision timeout.
Sourcepub const fn with_default_timeout(scheduler: Arc<Scheduler>) -> Self
pub const fn with_default_timeout(scheduler: Arc<Scheduler>) -> Self
Creates an executor using SupervisedExecutor::DEFAULT_TIMEOUT.
Sourcepub fn scheduler(&self) -> Arc<Scheduler> ⓘ
pub fn scheduler(&self) -> Arc<Scheduler> ⓘ
Returns the beamr scheduler backing supervised invocations.
Sourcepub fn execute(
&self,
function: &RoutingFunction,
message: RoutingMessage,
consumers: Vec<ConsumerStateView>,
) -> Result<RoutingDecision, FunctionError>
pub fn execute( &self, function: &RoutingFunction, message: RoutingMessage, consumers: Vec<ConsumerStateView>, ) -> Result<RoutingDecision, FunctionError>
Executes function against message and consumers under supervision.
The function runs in a dedicated supervised process, never on the calling thread, and receives the message and per-consumer state views.
§Errors
Returns FunctionError::Crashed if the function panics,
FunctionError::TimedOut if it exceeds the supervision timeout, and
FunctionError::SpawnFailed if the supervised process cannot start.
Trait Implementations§
Source§impl Clone for SupervisedExecutor
impl Clone for SupervisedExecutor
Source§fn clone(&self) -> SupervisedExecutor
fn clone(&self) -> SupervisedExecutor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more