Skip to content

Pragmatic.Discovery

Runtime topology registration and discovery for Pragmatic.Design hosts.

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.

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 backend
Host B (Billing) ── register ──▶ discovery backend
Host A ── "which host owns Billing?" ──▶ backend ──▶ call Host B over HTTP
Terminal window
dotnet add package Pragmatic.Discovery

IDiscoveryService 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.

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 |

  • .NET 10.0+

Part of the Pragmatic.Design ecosystem — see Licensing. Pragmatic.Discovery is MIT-licensed.