pub struct ProducerContext { /* private fields */ }Expand description
Context provided to producers for dependency injection.
ProducerContext holds references to shared infrastructure components
that producers may need access to during message production.
Extensible via default_headers (headers injected into every outgoing
message) and timeout_ms (per-producer timeout override).
Implementations§
Source§impl ProducerContext
impl ProducerContext
Sourcepub fn with_runtime(self, runtime: Arc<dyn RuntimeHandle>) -> Self
pub fn with_runtime(self, runtime: Arc<dyn RuntimeHandle>) -> Self
Attaches a runtime command/query handle.
Sourcepub fn runtime(&self) -> Option<&Arc<dyn RuntimeHandle>>
pub fn runtime(&self) -> Option<&Arc<dyn RuntimeHandle>>
Returns the runtime command/query handle, if configured.
Sourcepub fn with_default_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_default_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Sets a default header that will be injected into every outgoing message.
Sourcepub fn default_headers(&self) -> &HashMap<String, String>
pub fn default_headers(&self) -> &HashMap<String, String>
Returns the default headers map.
Sourcepub fn with_timeout_ms(self, timeout_ms: u64) -> Self
pub fn with_timeout_ms(self, timeout_ms: u64) -> Self
Sets a timeout in milliseconds for producer operations.
Sourcepub fn timeout_ms(&self) -> Option<u64>
pub fn timeout_ms(&self) -> Option<u64>
Returns the configured timeout in milliseconds, if any.
Trait Implementations§
Source§impl Clone for ProducerContext
impl Clone for ProducerContext
Source§fn clone(&self) -> ProducerContext
fn clone(&self) -> ProducerContext
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 moreAuto Trait Implementations§
impl Freeze for ProducerContext
impl !RefUnwindSafe for ProducerContext
impl Send for ProducerContext
impl Sync for ProducerContext
impl Unpin for ProducerContext
impl UnsafeUnpin for ProducerContext
impl !UnwindSafe for ProducerContext
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