Feedback deletedv1.0.0 · JSON Schema
Indicates that a customer feedback rating was deleted for a book. Rating API publishes this event so Catalog can remove it from its denormalized summary.
1. Subtract a Deleted Review Rating in Catalog
When a feedback record is deleted in Rating API, it dispatches FeedbackDeletedIntegrationEvent so Catalog API decrements the book’s TotalReviews and recalculates AverageRating.
Payload details
bookId: UUID of the book whose rating summary changes.rating: Integer rating (0–5) that was removed.feedbackId: UUID of the deleted feedback record.
Example payload
{ "bookId": "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a10", "rating": 5, "feedbackId": "01960a1b-5e6f-7a01-8a9b-0c1d2e3f4c01"}Using this example
Catalog API removes the rating from the book entity and persists the updated AverageRating and TotalReviews within an idempotent Wolverine handler.
using BookWorm.Chassis.EventBus;using BookWorm.Chassis.EventBus.Dispatcher;using BookWorm.Chassis.EventBus.Idempotency;using BookWorm.Contracts;using Wolverine.Attributes;
// Integration event contract (BookWorm.Contracts)[IntegrationMessageOwner(ServiceName = Services.Rating, TopicName = "feedback-delete")][MessageIdentity("BookWorm.Contracts.FeedbackDeletedIntegrationEvent")]public sealed record FeedbackDeletedIntegrationEvent(Guid BookId, int Rating, Guid FeedbackId) : IntegrationEvent;
// 1. Publishing from Rating API via BookWorm.Chassis IEventDispatcherawait eventDispatcher.DispatchAsync( new FeedbackDeletedEvent(feedback.BookId, feedback.Rating, feedback.Id), cancellationToken);
// 2. Consuming in Catalog API with Wolverine + IIntegrationEventIdempotencyGuardinternal sealed class FeedbackDeletedIntegrationEventHandler( IBookRepository repository, IIntegrationEventIdempotencyGuard? idempotencyGuard = null){ [WolverineHandler] public async Task Handle( FeedbackDeletedIntegrationEvent @event, CancellationToken cancellationToken ) { await idempotencyGuard.ExecuteAsync( @event.Id, nameof(FeedbackDeletedIntegrationEventHandler), async ct => { var book = await repository.GetByIdAsync(@event.BookId, ct); if (book is not null) { book.RemoveRating(@event.Rating); await repository.UnitOfWork.SaveEntitiesAsync(ct); } }, cancellationToken: cancellationToken ); }}1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "FeedbackDeletedIntegrationEvent",
4 "type": "object",
5 "additionalProperties": false,
6 "required": ["id", "creationDate", "bookId", "rating", "feedbackId"],
7 "properties": {
8 "id": {
9 "type": "string",
10 "format": "uuid",
11 "description": "Unique event identifier (UUIDv7) inherited from IntegrationEvent."
12 },
13 "creationDate": {
14 "type": "string",
15 "format": "date-time",
16 "description": "ISO 8601 UTC timestamp when the event was created."
17 },
18 "bookId": {
19 "type": "string",
20 "format": "uuid",
21 "description": "Identifier of the book whose rating summary changes."
22 },
23 "rating": {
24 "type": "integer",
25 "minimum": 0,
26 "maximum": 5,
27 "description": "Rating value removed from the book."
28 },
29 "feedbackId": {
30 "type": "string",
31 "format": "uuid",
32 "description": "Identifier of the deleted feedback record."
33 }
34 }
35}
36