pub struct JsonExecutionContextFactory;Expand description
Default factory that wraps actor JSON in a labeled ExecutionContext.
Suitable for examples and handlers that only need ExecutionContext::label and
ExecutionContext::actor_json. For application-specific identity (database sessions,
permission checks, typed actors), implement ExecutionContextFactory instead.
The default label keeps short actor JSON as-is (up to 64
characters) and replaces longer payloads with a stable json:<hash> form so logs stay
compact. The full actor payload remains available via actor_json.
§Example
Pass to BosonBuilder::execution_context_factory at worker boot:
ⓘ
use std::sync::Arc;
use boson_backend_mem::MemQueueBackend;
use boson_core::JsonExecutionContextFactory;
use boson_runtime::Boson;
let _boson = Boson::builder()
.queue_backend(Arc::new(MemQueueBackend::new()))
.execution_context_factory(JsonExecutionContextFactory)
.auto_registry()
.build()?;Trait Implementations§
Source§impl Clone for JsonExecutionContextFactory
impl Clone for JsonExecutionContextFactory
Source§fn clone(&self) -> JsonExecutionContextFactory
fn clone(&self) -> JsonExecutionContextFactory
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for JsonExecutionContextFactory
Source§impl Debug for JsonExecutionContextFactory
impl Debug for JsonExecutionContextFactory
Source§impl Default for JsonExecutionContextFactory
impl Default for JsonExecutionContextFactory
Source§fn default() -> JsonExecutionContextFactory
fn default() -> JsonExecutionContextFactory
Returns the “default value” for a type. Read more
Source§impl ExecutionContextFactory for JsonExecutionContextFactory
impl ExecutionContextFactory for JsonExecutionContextFactory
Source§fn build(
&self,
actor_json: &Value,
) -> Result<Box<dyn ExecutionContext>, IdentityError>
fn build( &self, actor_json: &Value, ) -> Result<Box<dyn ExecutionContext>, IdentityError>
Build context for task dispatch from stored
actor_json. Read moreAuto Trait Implementations§
impl Freeze for JsonExecutionContextFactory
impl RefUnwindSafe for JsonExecutionContextFactory
impl Send for JsonExecutionContextFactory
impl Sync for JsonExecutionContextFactory
impl Unpin for JsonExecutionContextFactory
impl UnsafeUnpin for JsonExecutionContextFactory
impl UnwindSafe for JsonExecutionContextFactory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more