pub struct MicroserviceContext { /* private fields */ }Expand description
MicroserviceContext
The execution context for handling microservice messages and events. Provides access to the DI container, transport info, and authentication.
Implementations§
Source§impl MicroserviceContext
impl MicroserviceContext
Sourcepub fn new(
container: Container,
transport: impl Into<String>,
pattern: impl Into<String>,
metadata: TransportMetadata,
) -> Self
pub fn new( container: Container, transport: impl Into<String>, pattern: impl Into<String>, metadata: TransportMetadata, ) -> Self
Creates a new microservice context.
§Arguments
container: The DI container for resolving servicestransport: The transport type (e.g., “tcp”, “redis”, “websocket”)pattern: The message/event patternmetadata: Additional transport metadata
Sourcepub fn metadata(&self) -> &TransportMetadata
pub fn metadata(&self) -> &TransportMetadata
Returns a reference to the transport metadata.
Sourcepub fn request_id(&self) -> Option<&RequestId>
pub fn request_id(&self) -> Option<&RequestId>
Returns the request ID if available.
pub fn auth_identity(&self) -> Option<&AuthIdentity>
pub fn resolve<T>(&self) -> Result<Arc<T>>
Trait Implementations§
Source§impl Clone for MicroserviceContext
impl Clone for MicroserviceContext
Source§fn clone(&self) -> MicroserviceContext
fn clone(&self) -> MicroserviceContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MicroserviceContext
impl RefUnwindSafe for MicroserviceContext
impl Send for MicroserviceContext
impl Sync for MicroserviceContext
impl Unpin for MicroserviceContext
impl UnsafeUnpin for MicroserviceContext
impl UnwindSafe for MicroserviceContext
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