pub struct SingleFieldStrategy { /* private fields */ }Expand description
Generates session keys from a single metadata field.
This is the simplest strategy: extract one field and use it as the session key. Optionally adds a prefix for namespacing.
§Example
use queue_runtime::sessions::SingleFieldStrategy;
// Create session keys from "user_id" like "user-12345"
let strategy = SingleFieldStrategy::new("user_id", Some("user"));Implementations§
Source§impl SingleFieldStrategy
impl SingleFieldStrategy
Sourcepub fn new(field_name: &str, prefix: Option<&str>) -> Self
pub fn new(field_name: &str, prefix: Option<&str>) -> Self
Create a new single field strategy.
§Arguments
field_name- The metadata field to use for the session keyprefix- Optional prefix to add before the field value
§Example
use queue_runtime::sessions::SingleFieldStrategy;
let strategy = SingleFieldStrategy::new("order_id", Some("order"));
// Produces keys like "order-123"Trait Implementations§
Source§impl SessionKeyGenerator for SingleFieldStrategy
impl SessionKeyGenerator for SingleFieldStrategy
Source§fn generate_key(&self, extractor: &dyn SessionKeyExtractor) -> Option<SessionId>
fn generate_key(&self, extractor: &dyn SessionKeyExtractor) -> Option<SessionId>
Generate a session key for the given message. Read more
Auto Trait Implementations§
impl Freeze for SingleFieldStrategy
impl RefUnwindSafe for SingleFieldStrategy
impl Send for SingleFieldStrategy
impl Sync for SingleFieldStrategy
impl Unpin for SingleFieldStrategy
impl UnsafeUnpin for SingleFieldStrategy
impl UnwindSafe for SingleFieldStrategy
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