# ZB.MOM.WW.CBDDC.Hosting ASP.NET Core integration for CBDDC with health checks and hosted services. ## Features - Cluster mode - Built-in health endpoint integration - Hosted services for sync server lifecycle - Respond-only server operation ## Installation ```bash dotnet add package ZB.MOM.WW.CBDDC.Hosting ``` ## Quick Start - Cluster ```csharp var builder = WebApplication.CreateBuilder(args); // Add CBDDC core + BLite persistence (custom DbContext + DocumentStore required) builder.Services.AddCBDDCCore() .AddCBDDCBLite( sp => new MyDbContext("/var/lib/cbddc/data.blite")); // Add ASP.NET integration (cluster mode) builder.Services.AddCBDDCHosting(options => { options.Cluster.NodeId = "server-01"; options.Cluster.TcpPort = 5001; }); var app = builder.Build(); app.MapHealthChecks("/health"); app.Run(); ``` ## Health Checks CBDDC registers health checks that verify: - Database connectivity - Latest timestamp retrieval ```bash curl http://localhost:5000/health ``` ## Deployment Mode ### Cluster Best for: - Dedicated database servers - Simple deployments - Development/testing environments ## Server Behavior CBDDC servers operate in respond-only mode: - Accept incoming sync connections - Respond to sync requests - Do not initiate outbound sync - Do not perform UDP discovery ## Configuration Options ### ClusterOptions | Property | Type | Default | Description | |--------------------|--------|-------------|------------------------| | NodeId | string | MachineName | Unique node identifier | | TcpPort | int | 5001 | TCP port for sync | | EnableUdpDiscovery | bool | false | Enable UDP discovery | ## Production Checklist - Store BLite database files on durable storage in production - Configure health checks for load balancer - Set up proper logging and monitoring - Configure backup/restore for BLite database files - Configure proper firewall rules for TCP port - Set unique NodeId per instance - Test failover scenarios ## License MIT