Explanation: JIT Federated Discovery (The Oracle)
JIT (Just-In-Time) Federated Discovery is the mechanism Framework M uses to resolve resource ownership in a distributed macroservice environment. It replaces the legacy model of unconditional startup broadcasts with a lazy, batch-capable query system.
The Problem: Broadcast Noise
In a large-scale deployment with dozens of micro-frontends (MFEs), a broadcast-only model creates significant overhead:
- Network Noise: Every service heartbeat consumes bandwidth.
- Memory Bloat: Every service must maintain a full global map of all DocTypes, even ones it never uses.
- Monolith Friction: In local development, overlapping broadcasts from a monolith and a standalone service create discovery conflicts.
Instead of pushing data to everyone, the framework now pulls data only when needed. The Gateway acts as the Oracle—the central authority that knows which service owns which resource.
The Handshake Flow
1. Fuzzy Suffix Matching
To improve developer experience, the PluginRegistry supports fuzzy matching. If a developer requests Invoice, but the registry only knows about sales.Invoice, the registry will:
- Check for an exact match.
- If missing, iterate through registered resources to find a suffix match (
*.Invoice). - If found, it automatically maps the short name to the fully-qualified namespaced owner.
2. Batching & Pre-warming
To minimize latency:
- Batching: Multiple resource requests are aggregated into a single
POSTto the Oracle. - Pre-warming: The Shell identifies "Core" services (Auth, Settings, Navigation) and warms them during the
prewarmCorephase before the UI is interactive.
3. Local Dev Parity
In local development, the "Oracle" behavior is maintained by running a local NATS instance. Every local process writes its manifest to a shared NATS KV bucket, ensuring that the same code paths used in production (JIT queries and real-time watchers) are exercised on localhost.