Skip to main content

Module registry

Module registry 

Source
Expand description

Module Service Registry - Discovery and access to module services

The Service Registry provides a centralized way for bounded contexts (modules) to expose services that other modules can discover and use. This enables loose-coupled inter-module communication beyond events.

§Architecture

                   ┌────────────────────────────┐
                   │     ServiceRegistry        │
                   │  (Application Bootstrap)   │
                   └────────────────────────────┘
                             │
             ┌───────────────┼───────────────┐
             │               │               │
             ▼               ▼               ▼
    ┌────────────┐  ┌────────────┐  ┌────────────┐
    │  Sapiens   │  │  Postman   │  │  Bucket  │
    │  Services  │  │  Services  │  │  Services  │
    └────────────┘  └────────────┘  └────────────┘

§Usage

ⓘ
use backbone_core::registry::{ServiceRegistry, ModuleService};

// Create registry in main app
let registry = ServiceRegistry::new();

// Register services from modules
registry.register(user_query_service).await;
registry.register(email_service).await;

// Look up services
if let Some(service) = registry.get("sapiens.user_query").await {
    // Use the service
}

Structs§

RegistryHealth
Health report for the entire registry
RegistryStatistics
Statistics about the registry
ServiceDescriptor
Metadata about a registered service
ServiceHealth
Health status of a service
ServiceRegistry
Registry for discovering and accessing module services

Enums§

HealthStatus

Traits§

ModuleService
Trait for module services that can be registered and discovered