Pragmatic.Discovery
Runtime topology registration and discovery for Pragmatic.Design hosts.
The Problem
Section titled “The Problem”A modular monolith splits logic into modules, each with its own database. In a single host, the
Composition generator validates the whole topology at compile time. But split modules across multiple
hosts and that validation disappears: you can’t know at build time whether two hosts deploy the same
module, whether ReadAccess spans hosts (breaking SQL joins), or whether DB providers mismatch.
External registries (Consul, etcd) know “Host B is alive at :5002” — not “Host B owns BillingModule on
BillingDb with PostgreSQL.” So you maintain a separate config that drifts from the code.
The Solution
Section titled “The Solution”Pragmatic.Discovery reads the SG-emitted topology metadata that already lives in every compiled host assembly, stores it in a shared backend, and validates the deployment against the other hosts — automatically, at startup. No manual config, no drifting registry; the metadata travels with the assembly.
Host A (Booking + Catalog) ── register ──▶ discovery backendHost B (Billing) ── register ──▶ discovery backendHost A ── "which host owns Billing?" ──▶ backend ──▶ call Host B over HTTPInstallation
Section titled “Installation”dotnet add package Pragmatic.DiscoveryIDiscoveryService is the high-level API (register / query / validate); IDiscoveryBackend is the
pluggable store (InMemory default; SignalR/control-plane, Redis, Consul). Validation runs at startup
and flags duplicate modules, cross-host ReadAccess, and provider mismatches.
Status
Section titled “Status”Topology registration, querying, validation, and the InMemory/control-plane backends are functional within the 0.8 preview. See the roadmap.
| Concepts | Topology metadata, the backend model, register/query/validate | | Getting Started | Register a host and query the topology | | Topology Validation | Cross-host checks: duplicate modules, ReadAccess, provider mismatch | | Common Mistakes | The most frequent discovery pitfalls | | Troubleshooting | Problem/solution guide |
Requirements
Section titled “Requirements”- .NET 10.0+
License
Section titled “License”Part of the Pragmatic.Design ecosystem — see Licensing. Pragmatic.Discovery is MIT-licensed.