Service Discovery / Registry

Service registry and discovery for Spring Boot microservices

The Registry Service is the control plane of Spring Middleware. It provides service discovery, tracks clusters and running nodes, and stores metadata such as REST resources and GraphQL schema locations. This allows Spring Boot microservices to remain autonomous while the platform stays discoverable and consistent.

Service discovery Control plane Cluster + node model REST resource registration GraphQL schema discovery Topology awareness

What the Registry is

The Registry provides the central source of truth for platform topology and API metadata. It knows which logical services exist, which nodes are currently running for each service, which REST resources are registered, and which GraphQL schemas are available in the platform.

  • Discover clusters and node endpoints
  • Track registered REST APIs
  • Track registered GraphQL schema locations
  • Detect and remove missing or unhealthy nodes

What the Registry is not

The Registry is not where business logic runs, and it is not where GraphQL queries are executed. It exists to expose accurate topology and metadata so the rest of the platform can route requests, compose schemas, and keep runtime behavior explicit.

  • Not a business service: it coordinates topology, not domain logic.
  • Not a GraphQL executor: it stores schema metadata, not query results.
  • Not hidden magic: services still expose and register themselves explicitly.

Registry-driven topology

The Registry sits in the control plane and exposes the information needed for service-to-service communication, topology awareness, REST inspection, and GraphQL discovery.

Registry Service control plane for topology and metadata Clusters logical service identities Nodes running endpoints and health REST Resources registered API metadata Schema Locations GraphQL discovery metadata Used by the platform for discovery and routing MiddlewareClient • GraphQL gateway • tooling • health-based cleanup

Core concepts

The Registry is built around a small set of explicit concepts that define service identity and metadata.

Cluster

A cluster is the logical service identifier, such as product-service, catalog-service, or order-service. In many environments it maps naturally to a Kubernetes Service or a logical service name.

Node

A node is a running instance of a cluster: a pod, container, VM, or bare endpoint. Clusters typically have multiple nodes for scalability and redundancy.

Resource

A resource is a registered REST endpoint exposed by a service. Spring Middleware discovers and registers resources from annotated controllers.

GraphQL schema

A GraphQL schema is registered as metadata describing where the schema lives and which nodes expose it. The Registry stores discovery information, not query execution state.

Data model

Two key models define most of the registry runtime view: RegistryEntry and SchemaLocation.

RegistryEntry

RegistryEntry represents a service registered in the Registry and contains the information needed for service discovery and endpoint resolution.

  • clusterEndpoint — logical endpoint or base URL of the cluster
  • nodeEndpoints — concrete endpoints for running nodes
  • publicEndpoint — optional externally-facing endpoint

SchemaLocation

SchemaLocation represents GraphQL schema metadata used for discovery and future schema composition.

  • namespace — logical schema namespace
  • location — schema location reference
  • contextPath — service context path
  • pathApi — GraphQL endpoint path
  • schemaLocationNodes — nodes exposing the schema

Core responsibilities

The Registry keeps topology and metadata coherent so the rest of the platform can operate against an explicit runtime view.

Maintain topology

Track clusters, nodes, endpoints, and health-related state across the platform.

Support discovery

Provide lookup data for clients such as @MiddlewareClient and platform gateways.

Store API metadata

Keep registered REST resources and GraphQL schema locations available for tooling and routing.

Service bootstrapping and registration

Services interact with the Registry as part of startup, registration, and periodic topology consistency checks.

01

Spring Boot initialization

The application context is created and the service runtime starts normally.

02

Annotation scanning

Spring Middleware scans registration-related annotations such as @Register.

03

Resource and schema registration

REST resource metadata and GraphQL schema locations are registered in the Registry.

04

Node registration

The running instance registers itself as a node in the cluster.

05

Consistency scheduling

A scheduler revalidates topology and re-registers or cleans up state when needed.

Service discovery and communication

The communication layer uses the Registry to resolve where calls should go when a declarative client is invoked.

01

Client identifies the cluster

The service attribute on @MiddlewareClient identifies the target cluster.

02

Registry lookup

The communication layer resolves the cluster to a RegistryEntry.

03

Node selection

A node selection strategy chooses one of the available node endpoints.

04

Request execution

The HTTP request is sent only to nodes considered available by the Registry view.

When a node disappears

If the Registry removes a node due to health failure or missing heartbeat, that node is no longer selected for new service-to-service calls.

When a cluster cannot be found

The communication layer can surface a structured service-unavailable error, including lookup details in the error extensions when relevant.

GraphQL integration

For GraphQL, the Registry is responsible for schema discovery metadata, not execution.

Schema registration

Services that expose GraphQL APIs register one or more SchemaLocation entries so platform components can discover them later.

  • Map schema namespace to service and nodes
  • Store context path and endpoint path
  • Keep schema discovery metadata current over time

Gateway support

A GraphQL gateway can query the Registry for schema locations, load available schemas, and build a unified runtime view across services.

  • Discover schemas dynamically
  • Map services to schema owners
  • Support future composition and federation strategies

Registry implementation modules

In the repository, the Registry is implemented through a small set of dedicated modules that separate model, service logic, and boot runtime.

registry-model

Shared data model for registry entries, schema locations, and topology-related structures.

registry-service

Core registry logic, persistence, service APIs, and topology management behavior.

registry-boot

Boot application that runs the Registry as a standalone infrastructure service.

Configuration and operations

From the point of view of an application service, the most important concern is how to reach the Registry. Operationally, the Registry should be treated as critical platform infrastructure.

Typical concerns

  • Registry service URL
  • Authentication and authorization if enabled
  • Health check timing and cleanup behavior
  • Persistence mode and durability

Operational expectations

  • Deploy redundantly when needed
  • Monitor health and latency
  • Protect persistent state if applicable
  • Treat outages as platform-level incidents