Microservices & Federation
Microservices & Federation
ObjectQL provides a built-in mechanism to aggregate data from multiple services into a single unified graph. This is similar to GraphQL Federation or Salesforce's External Objects, but strictly for the ObjectQL protocol.
Concept: Remote Remotes
You can configure an ObjectQL instance to act as a Gateway. It connects to other ObjectQL instances, downloads their metadata (Schema), and automatically creates proxy drivers for them.
- Source of Truth: The microservice defines the object (
user.object.yml). - Proxy: The gateway sees a virtual object (
user) and forwards all queries (Find, Update, Actions) to the microservice.
Configuration
The Subgraph (Service A)
This is a standard ObjectQL service running standard drivers (SQL/Mongo).
It must expose the metadata API (default in @objectql/server).
The Gateway
The gateway aggregates multiple services.
Usage
Once initialized, the Gateway behaves exactly like a monolith.
Benefits
- Decoupling: Services manage their own schema migrations and domain logic.
- Unity: Frontend or upper layers see a single API surface.
- Hybrid: A Gateway can also have local objects. You can mix "local cache tables" with "remote live tables" in the same application.