---
id: bookworm.{env}.catalog.book-update-rating-failed
name: Book Rating Update Failed Channel
version: 1.0.0
type: topic
summary: |
  Kafka compensation topic owned by the contributor team used by Catalog API
  when a feedback-created event references a missing book.
owners:
  - catalog-experience-team
badges:
  - content: Kafka
    backgroundColor: blue
    textColor: blue
  - content: Compensation
    backgroundColor: orange
    textColor: orange
address: bookworm.{env}.catalog.book-update-rating-failed
parameters:
  env:
    enum:
      - development
      - staging
      - production
    default: development
    examples:
      - development
      - staging
      - production
    description: BookWorm deployment environment.
deliveryGuarantee: at-least-once
protocols:
  - kafka
deadLetterChannel:
  id: bookworm.{env}.rating.dead-letter-queue
  version: 1.0.0
---

## Purpose & Scope

This compensation topic carries failure signals published by [[service|catalog-api]] within the Catalog bounded context when a newly submitted feedback event references a book that does not exist. [[service|rating-api]] consumes this event to remove the orphaned feedback record and keep rating data consistent. Feedback deletions for unknown books are ignored and do not emit this signal.

## Channel Specification

| Property                               | Value                                                                     |
| :------------------------------------- | :------------------------------------------------------------------------ |
| **Bounded Context / Owner**            | [[domain\|catalog]] / [[team\|catalog-experience-team]]                   |
| **Channel Type**                       | Topic                                                                     |
| **Address Pattern**                    | `bookworm.{env}.catalog.book-update-rating-failed`                        |
| **Parameters**                         | `env` (`development`, `staging`, `production`; default: `development`)    |
| **Protocol & Envelope Format**         | Kafka + CloudEvents JSON (`application/json`)                             |
| **Partition Key & Ordering Guarantee** | Keyed by `feedbackId`; preserves per-feedback ordering within a partition |
| **Delivery Semantics**                 | At-least-once                                                             |
| **Dead-Letter Channel**                | [[channel\|bookworm.&#123;env&#125;.rating.dead-letter-queue]]            |

## Messages & Participants

| Message                                            | Type  | Producer                 | Consumer(s)             | Consumer Group          |
| :------------------------------------------------- | :---- | :----------------------- | :---------------------- | :---------------------- |
| [[event\|BookUpdatedRatingFailedIntegrationEvent]] | Event | [[service\|catalog-api]] | [[service\|rating-api]] | Rating service consumer |

## Ordering, Retries & Failure Handling

- **Partition-key ordering:** Records are partitioned by `feedbackId` so compensation actions for the same feedback item are serialized.
- **Transient retries:** [[service|rating-api]] performs bounded retries with backoff for transient database or network errors.
- **Immediate DLQ routing:** Poison payloads, deserialization errors, or exhausted retries route to [[channel|bookworm.&#123;env&#125;.rating.dead-letter-queue]].
- **Consumer idempotency:** Removing an already-deleted feedback record is a safe no-op.

## Channel Details & Visualization

<ChannelInformation />

<NodeGraph />

## Related Documentation

- [[channel|bookworm.&#123;env&#125;.rating.dead-letter-queue]] — Consumer dead-letter queue
- [[channel|bookworm.&#123;env&#125;.rating.feedback-create]] — Upstream feedback creation topic
- [[service|catalog-api]] — Compensation producer
- [[service|rating-api]] — Compensation consumer
- [[flow|feedback-publication]] — Feedback publication and compensation flow
- [[doc|arc42/08-crosscutting-concepts/002-contracts-and-messaging]] — Messaging standards and idempotency rules
