pub struct CompositeKeyStrategy { /* private fields */ }Expand description
Generates session keys by composing multiple metadata fields.
This strategy builds session keys from a list of metadata fields in order, joining them with a separator. This is useful for creating hierarchical or compound session keys.
§Example
use queue_runtime::sessions::CompositeKeyStrategy;
// Create session keys like "tenant-123-resource-456"
let strategy = CompositeKeyStrategy::new(vec![
"tenant_id".to_string(),
"resource_id".to_string(),
], "-");Implementations§
Source§impl CompositeKeyStrategy
impl CompositeKeyStrategy
Sourcepub fn new(fields: Vec<String>, separator: &str) -> Self
pub fn new(fields: Vec<String>, separator: &str) -> Self
Create a new composite key strategy.
§Arguments
fields- Ordered list of metadata field names to composeseparator- String to join field values with
§Example
use queue_runtime::sessions::CompositeKeyStrategy;
let strategy = CompositeKeyStrategy::new(
vec!["region".to_string(), "customer_id".to_string()],
"-"
);Trait Implementations§
Source§impl SessionKeyGenerator for CompositeKeyStrategy
impl SessionKeyGenerator for CompositeKeyStrategy
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 CompositeKeyStrategy
impl RefUnwindSafe for CompositeKeyStrategy
impl Send for CompositeKeyStrategy
impl Sync for CompositeKeyStrategy
impl Unpin for CompositeKeyStrategy
impl UnsafeUnpin for CompositeKeyStrategy
impl UnwindSafe for CompositeKeyStrategy
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