Expand description
Process routing registry.
Maps string routing keys to ProcessIdentity values so inbound
EDIFACT messages can be dispatched to the correct running process without
the caller managing a bespoke routing table.
§Routing key conventions
Any stable string that uniquely identifies a process for a given message type works as a routing key. Common patterns:
| Message type | Recommended key |
|---|---|
| UTILMD waiting for APERAK | RegistryKey::from_conversation_and_sender(conversation_id, sender_gln) |
| Route follow-up by correlation | RegistryKey::from_correlation(correlation_id) |
| Direct lookup by process | RegistryKey::from_process(process_id) |
One process may be registered under multiple keys when it handles several different message types simultaneously.
§Tenant scoping
All registry operations are scoped to a TenantId. This prevents routing
keys from leaking across tenant boundaries when the engine handles multiple
market participants in a single deployment.
§Usage
ⓘ
// After spawning a process, register it under the UTILMD conversation ID + sender GLN:
ctx.registry
.register(tenant_id, &RegistryKey::from_conversation_and_sender(utilmd_conv_id, sender_gln), process.identity())
.await?;
// When the APERAK arrives, look up by conversation ID + APERAK sender GLN:
let identity = ctx.registry
.lookup(tenant_id, &RegistryKey::from_conversation_and_sender(aperak_conv_id, aperak_sender_gln))
.await?
.ok_or(EngineError::registry("unknown conversation"))?;
let process = ctx.resume::<SupplierChangeWorkflow>(identity);
process.execute(HandleAperak { .. }).await?;
// Clean up after process completion:
ctx.registry.remove(tenant_id, &RegistryKey::from_conversation_and_sender(utilmd_conv_id, sender_gln)).await?;Structs§
- Noop
Process Registry - A
ProcessRegistrythat never stores any mappings. - Registry
Key - A typed routing key for the
ProcessRegistry.
Constants§
- MAX_
REGISTRY_ KEY_ LEN - Maximum byte length for a
RegistryKeyrouting key.
Traits§
- Process
Registry - Routes inbound messages to their target processes by string key.