---
id: FeedbackCreatedIntegrationEvent
name: Feedback created
version: 1.0.0
summary: |
  Indicates that a customer feedback rating was created for a book. Rating API
  publishes this event so Catalog can update its denormalized rating summary.
owners:
  - catalog-experience-team
schemaPath: schema.json
badges:
  - content: Reviews
    backgroundColor: purple
    textColor: purple
---

`FeedbackCreatedIntegrationEvent` (v1.0.0) signals that [[service|rating-api]] persisted a new customer [[entity|feedback]] document in Azure Cosmos DB. [[service|catalog-api]] consumes this event to increment the target book's denormalized rating summary in PostgreSQL.

## Overview

| Property                             | Value                                                                                            |
| :----------------------------------- | :----------------------------------------------------------------------------------------------- |
| **Bounded Context**                  | Reviews                                                                                          |
| **Producer**                         | [[service\|rating-api]]                                                                          |
| **Consumer(s)**                      | [[service\|catalog-api]]                                                                         |
| **Protocol / Format**                | Kafka + CloudEvents JSON (camelCase payload)                                                     |
| **Channel / Topic**                  | [[channel\|bookworm.&#123;env&#125;.rating.feedback-create]]                                     |
| **Dead-Letter Channel**              | [[channel\|bookworm.&#123;env&#125;.catalog.dead-letter-queue]]                                  |
| **Partition Key**                    | `BookId`                                                                                         |
| **Delivery / Idempotency Guarantee** | Published via transactional outbox; consumed with Redis-backed 24-hour idempotency keyed by `id` |

## Payload Fields & Envelope

### Event Payload

| Name           | Type                   | Required | Constraints                     | Description                                                                                   |
| :------------- | :--------------------- | :------- | :------------------------------ | :-------------------------------------------------------------------------------------------- |
| `id`           | `string` (`uuid`)      | Yes      | UUIDv7                          | Unique event identifier used by [[service\|catalog-api]] as the Redis idempotency key         |
| `creationDate` | `string` (`date-time`) | Yes      | ISO 8601 UTC timestamp          | UTC timestamp when the event was created                                                      |
| `bookId`       | `string` (`uuid`)      | Yes      | Valid UUID; Kafka partition key | Identifier of the book whose rating summary must be updated                                   |
| `rating`       | `integer`              | Yes      | `0`-`5`                         | Rating score to add to the book's denormalized rating summary                                 |
| `feedbackId`   | `string` (`uuid`)      | Yes      | Valid UUID                      | Identifier of the newly created feedback record, used for compensation if the book is missing |

### CloudEvents Envelope Headers

| Header        | Value / Source                                       | Purpose                                                     |
| :------------ | :--------------------------------------------------- | :---------------------------------------------------------- |
| `messagetype` | `BookWorm.Contracts.FeedbackCreatedIntegrationEvent` | Explicit message identity for cross-service deserialization |
| `source`      | `urn:bookworm:bookworm-rating`                       | Identifies the producing service                            |
| `requestid`   | Propagated from `POST /rating/api/v1/feedbacks`      | Correlates review creation with catalog projection updates  |

## Delivery Guarantees & Error Handling

| Condition                                         | System Behavior                                                                     | Recovery / Compensation                                                                     |
| :------------------------------------------------ | :---------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |
| Duplicate delivery within 24 hours                | Consumer skips reprocessing via Redis-backed 24-hour idempotency keyed by `id`      | Prevents double-counting a rating on retries                                                |
| Target book not found in [[service\|catalog-api]] | Consumer emits [[event\|BookUpdatedRatingFailedIntegrationEvent]] with `feedbackId` | [[service\|rating-api]] reverts and deletes the orphaned feedback record                    |
| Transient database or concurrency error           | Retried with cooldown (`50ms`, `250ms`, `1s`) and full jitter                       | Exhausted messages route to [[channel\|bookworm.&#123;env&#125;.catalog.dead-letter-queue]] |
| Deserialization failure                           | Routed directly to [[channel\|bookworm.&#123;env&#125;.catalog.dead-letter-queue]]  | Inspect dead-letter payload against contract schema                                         |

## Related Documentation

- [[service|rating-api]] — Producer service owning feedback records.
- [[service|catalog-api]] — Consumer service maintaining denormalized book ratings.
- [[channel|bookworm.&#123;env&#125;.rating.feedback-create]] — Kafka channel specification.
- [[channel|bookworm.&#123;env&#125;.catalog.dead-letter-queue]] — Dead-letter channel for failed Catalog consumers.
- [[event|BookUpdatedRatingFailedIntegrationEvent]] — Compensating event emitted when the referenced book does not exist.
- [[event|FeedbackDeletedIntegrationEvent]] — Companion event for removing a deleted rating.
- [[entity|feedback]] — Feedback document schema.

<NodeGraph />

<SchemaViewer file="schema.json" title="Feedback created schema" maxHeight="500" search="true" />


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "FeedbackCreatedIntegrationEvent",
	"type": "object",
	"additionalProperties": false,
	"required": ["id", "creationDate", "bookId", "rating", "feedbackId"],
	"properties": {
		"id": {
			"type": "string",
			"format": "uuid",
			"description": "Unique event identifier (UUIDv7) inherited from IntegrationEvent."
		},
		"creationDate": {
			"type": "string",
			"format": "date-time",
			"description": "ISO 8601 UTC timestamp when the event was created."
		},
		"bookId": {
			"type": "string",
			"format": "uuid",
			"description": "Identifier of the book whose rating summary changes."
		},
		"rating": {
			"type": "integer",
			"minimum": 0,
			"maximum": 5,
			"description": "Rating value added to the book."
		},
		"feedbackId": {
			"type": "string",
			"format": "uuid",
			"description": "Identifier of the feedback record."
		}
	}
}
