Rating Database
Authoritative Azure Cosmos DB system of record owned by the Reviews bounded context for customer feedback documents partitioned by book ID.
Purpose & Ownership Boundary
Rating Database (ratingdb) is the authoritative Azure Cosmos DB system of record owned exclusively by Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and
summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs in the Reviews bounded context. Cosmos DB was chosen for low-latency, single-partition document reads keyed by /bookId when listing book reviews or running AI summarization, alongside native Wolverine Cosmos DB message persistence.
Data Store Profile
| Property | Value |
|---|---|
| Bounded Context / Owner | Reviews — Catalog Experience TeamTeamCatalog Experience TeamStream-Aligned team owning BookWorm's product catalog, customer reviews, and storefront/backoffice discovery experience....Open docs |
| Engine / Technology | Azure Cosmos DB (NoSQL API; Cosmos DB Emulator locally) |
| Store Type | Database |
| Primary Writer(s) | Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs |
| Primary Reader(s) | Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs, Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs (governed read-only tool) |
| Authoritative / Source of Truth | Yes |
| Data Classification | Internal (reviewer firstName and lastName treated as PII in command logging) |
| Retention / TTL Policy | Indefinite |
Logical Data Layout & Key Patterns
| Container | Owned Entity | Partition / Primary Key | Purpose & Concurrency |
|---|---|---|---|
feedbacks | FeedbackEntityv1.0.0FeedbackRepresents an individual customer's rating and optional written review for a Catalog book.Ownercatalog-experience-teamOpen docs | Partition key: /bookId (uuid); Document key: id (uuid) | Stores bookId, firstName (max 50), lastName (max 50), optional comment (max 1,000), rating (0–5), createdAt, lastModifiedAt; optimistic concurrency via _etag. |
| Wolverine persistence | — | Envelope ID | Durable integration message state in ratingdb for Feedback createdEventv1.0.0Feedback createdIndicates that a customer feedback rating was created for a book. Rating API
publishes this event so Catalog can update ...Ownercatalog-experience-teamSchemaDiagramOpen docs and Feedback deletedEventv1.0.0Feedback deletedIndicates that a customer feedback rating was deleted for a book. Rating API
publishes this event so Catalog can remove ...Ownercatalog-experience-teamSchemaDiagramOpen docs. |
Consistency, Isolation & Security Guardrails
- ETag optimistic concurrency & conflicts: Concurrent modifications raise ETag concurrency failures, and duplicate/conflict responses (
409 Conflict) are surfaced cleanly at the API boundary. Note that the provisionedfeedbackscontainer declares/bookIdas its partition key without a Cosmos unique-key policy. - Governed read-only agent access: Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs reads reviews through its governed review-lookup tool (
default_action: deny, rate-limited at30/minute). Generated AI summaries and classifications are never written back toratingdb. - Eventual consistency with Catalog: Catalog APIServicev1.0.0Catalog APIInternal HTTP and gRPC service for Catalog product management, hybrid
discovery, and authoritative book metadata.
PublishesBookUpdatedRatingFailedIntegrationEventSubscribesCreatePublisher, UpdatePublisher +24APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs never queries Cosmos DB directly; it consumes Feedback createdEventv1.0.0Feedback createdIndicates that a customer feedback rating was created for a book. Rating API
publishes this event so Catalog can update ...Ownercatalog-experience-teamSchemaDiagramOpen docs and Feedback deletedEventv1.0.0Feedback deletedIndicates that a customer feedback rating was deleted for a book. Rating API
publishes this event so Catalog can remove ...Ownercatalog-experience-teamSchemaDiagramOpen docs to update derived
average_ratingandtotal_reviewsprojections in Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs. - PII & validation: Reviewer
firstNameandlastNameare annotated for PII redaction in command logs, and rating bounds (0–5) are enforced at the Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs boundary.
Database-per-Service Isolation: Only Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and
summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs may write to ratingdb, and Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs is restricted to governed read-only queries. Never run PostgreSQL DDL scripts against Rating in live environments (the attached schema.sql is a legacy/reference relational DDL only; the active store is Azure Cosmos DB).
Operational & Resilience Notes
- Local vs. Cloud: Local development uses a persistent Azure Cosmos DB Emulator with Data
Explorer; Azure Development and Staging use Serverless capacity, while Production uses
provisioned throughput. - Authentication: Staging and Production disable local keys
(
DisableLocalAuth = true) and enforce Microsoft Entra ID RBAC exclusively.
Architecture Visualizations & Schema
Loading graph...
CREATE TABLE feedbacks ( id uuid NOT NULL DEFAULT uuidv7(), first_name character varying(50) NOT NULL, last_name character varying(50) NOT NULL, comment character varying(1000), rating integer NOT NULL, created_at timestamp with time zone NOT NULL, last_modified_at timestamp with time zone, book_id uuid NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', CONSTRAINT pk_feedbacks PRIMARY KEY (id));
CREATE UNIQUE INDEX ix_feedbacks_book_id_first_name_last_name ON feedbacks (book_id, first_name, last_name);Related Documentation
- Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs — Owning service REST endpoints, Cosmos DB wiring, and A2A gRPC server.
- Rating CacheContainerv1.0.0Rating CacheNon-authoritative FusionCache and Redis caching layer owned by the Reviews bounded context for AI-generated book feedbac...Ownercatalog-experience-teamDiagramOpen docs — FusionCache L1 + Redis L2 cache for AI feedback summaries.
- Rating AgentAgentv1.0.0Rating AgentRead-only review intelligence specialist that summarizes customer feedback over A2A gRPC and map-reduce workflows while ...PublishesAnalyzeText, AnonymizeTextOwnercatalog-experience-teamDiagramRepositoryOpen docs — Read-only review summarization and quality assessment agent.
- Catalog DatabaseContainerv1.0.0Catalog DatabaseAuthoritative PostgreSQL system of record owned by the Catalog bounded context for books, authors, categories, publisher...Ownercatalog-experience-teamDiagramOpen docs — Downstream PostgreSQL store maintaining derived book rating summaries.
- ADR-001: Use PostgreSQL as the feedback system of recordDecision Recordv1.0.0ADR-001: Use PostgreSQL as the feedback system of recordRating Database (PostgreSQL) is the authoritative store for individual customer feedback; no other domain may read or wr...Ownercatalog-experience-teamOpen docs — Decision record for feedback persistence and boundaries.
- Backup, Restore & Disaster Recovery (DR)Custom DocBackup, Restore & Disaster Recovery (DR)Operator runbook for PostgreSQL point-in-time restore, Cosmos DB failover verification, Blob Storage recovery, and Qdran...Ownerplatform-engineering-teamOpen doc — Platform backup, restore, and disaster recovery runbook.