pub struct RegistryKey(/* private fields */);Expand description
A typed routing key for the ProcessRegistry.
Using a newtype instead of a bare &str prevents accidental key-format
mismatches (e.g. mixing conversation_id and correlation_id keys at
different call sites) and makes the key derivation convention explicit at
the type level.
§Named constructors
| Constructor | Use case |
|---|---|
| Constructor | Use case |
| — | — |
from_conversation_and_sender | Route inbound APERAK by UTILMD conversation ID + sender GLN |
from_correlation | Route follow-up messages by root correlation |
from_process | Direct lookup by process instance |
parse | Primary validated constructor for runtime-derived keys |
from_static | Infallible constructor for compile-time-known string literals |
Implementations§
Source§impl RegistryKey
impl RegistryKey
Sourcepub fn from_conversation_and_sender(
id: ConversationId,
sender_gln: &str,
) -> Self
pub fn from_conversation_and_sender( id: ConversationId, sender_gln: &str, ) -> Self
Key derived from a conversation ID and sender GLN.
This is the correct constructor for UTILMD ↔ APERAK routing in multi-market-participant deployments.
§Why sender is required
EDIFACT conversation IDs are assigned by the sender within their own numbering space. Two senders may independently assign the same conversation-ID string, which would collide if keyed on conversation alone. Including the sender GLN as a discriminator makes the key globally unique within the tenant’s namespace.
§Key format
"{sender_gln}:{conversation_id}" — stable, URL-safe, human-readable.
Sourcepub fn from_correlation(id: CorrelationId) -> Self
pub fn from_correlation(id: CorrelationId) -> Self
Key derived from a correlation ID (route all messages in the same root trace).
Sourcepub fn from_process(id: ProcessId) -> Self
pub fn from_process(id: ProcessId) -> Self
Key derived from a process ID (direct process lookup).
Sourcepub fn parse(s: &str) -> Result<Self, EngineError>
pub fn parse(s: &str) -> Result<Self, EngineError>
Primary validated constructor for runtime-derived keys.
Returns EngineError::Registry when s contains a NUL byte or
exceeds MAX_REGISTRY_KEY_LEN bytes. Use this for all keys derived
from untrusted input (e.g. EDIFACT MessageId, AS4 conversation_id,
or user-supplied strings).
§Errors
EngineError::Registrywhenscontains\0.EngineError::Registrywhens.len() > MAX_REGISTRY_KEY_LEN.
Sourcepub fn from_static(s: &'static str) -> Self
pub fn from_static(s: &'static str) -> Self
Infallible constructor for compile-time-known string literals.
Panics at runtime if s contains a NUL byte or exceeds
MAX_REGISTRY_KEY_LEN — but since this is only correct to call with
string literals, any violation would be caught immediately in tests.
§Panics
Panics when s contains a NUL byte or exceeds MAX_REGISTRY_KEY_LEN
bytes. Only use this with string literals. Use parse for any
value that may be runtime-derived.
Trait Implementations§
Source§impl Clone for RegistryKey
impl Clone for RegistryKey
Source§fn clone(&self) -> RegistryKey
fn clone(&self) -> RegistryKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegistryKey
impl Debug for RegistryKey
Source§impl<'de> Deserialize<'de> for RegistryKey
impl<'de> Deserialize<'de> for RegistryKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for RegistryKey
impl Display for RegistryKey
impl Eq for RegistryKey
Source§impl FromStr for RegistryKey
impl FromStr for RegistryKey
Source§impl Hash for RegistryKey
impl Hash for RegistryKey
Source§impl PartialEq for RegistryKey
impl PartialEq for RegistryKey
Source§fn eq(&self, other: &RegistryKey) -> bool
fn eq(&self, other: &RegistryKey) -> bool
self and other values to be equal, and is used by ==.