Order cancelledv1.0.0 · JSON Schema
Reports that an Order transitioned from New to Cancelled.
1. Publish Order Cancellation Event to Kafka
When an order transitions to Cancelled, Ordering API dispatches OrderStatusChangedToCancelIntegrationEvent via IEventDispatcher so Finance can advance or terminate the saga and trigger CancelOrderCommand.
Payload details
id: UUIDv7 generated byIntegrationEvent(Guid.CreateVersion7()).creationDate: UTC ISO 8601 timestamp (DateTime.UtcNow).orderId: UUID of the cancelled order (Kafka partition key).basketId: UUID serialized asbasketId(supplied fromOrder.BuyerIdbyOrderEventMapper).fullName: Customer name (string | null).email: Customer email (string | null).totalMoney: Order total (decimal).
Example payload
{ "id": "01960a1b-9001-7c00-8a9b-0c1d2e3f4g01", "creationDate": "2026-11-25T16:20:00Z", "orderId": "01960a1b-3c4d-7e00-8a9b-0c1d2e3f4a99", "basketId": "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a01", "fullName": "Minh Nguyen", "email": "minh.nguyen@bookworm.dev", "totalMoney": 59.98}Using this example
Ordering API publishes OrderStatusChangedToCancelIntegrationEvent to bookworm.{env}.ordering.order-cancel via its transactional outbox; Finance raises the external event to OrderOrchestrator, which issues CancelOrderCommand.
using BookWorm.Chassis.EventBus;using BookWorm.Chassis.EventBus.Dispatcher;using BookWorm.Contracts;using Wolverine.Attributes;
// Integration event contract (BookWorm.Contracts)[IntegrationMessageOwner(ServiceName = Services.Ordering, TopicName = "order-cancel")][MessageIdentity("BookWorm.Contracts.OrderStatusChangedToCancelIntegrationEvent")]public sealed record OrderStatusChangedToCancelIntegrationEvent( Guid OrderId, Guid BasketId, string? FullName, string? Email, decimal TotalMoney) : IntegrationEvent;
// Publishing from Ordering API via BookWorm.Chassis IEventDispatcherawait eventDispatcher.DispatchAsync( new OrderCancelledEvent(order), cancellationToken);1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "OrderStatusChangedToCancelIntegrationEvent",
4 "type": "object",
5 "additionalProperties": false,
6 "required": ["id", "creationDate", "orderId", "basketId", "fullName", "email", "totalMoney"],
7 "properties": {
8 "id": {
9 "type": "string",
10 "format": "uuid",
11 "description": "Unique identifier assigned to the integration event."
12 },
13 "creationDate": {
14 "type": "string",
15 "format": "date-time",
16 "description": "UTC timestamp when the integration event was created."
17 },
18 "orderId": {
19 "type": "string",
20 "format": "uuid",
21 "description": "Identifier of the Order."
22 },
23 "basketId": {
24 "type": "string",
25 "format": "uuid",
26 "description": "UUID serialized as basketId. The current EventMapper supplies the\nOrder's BuyerId for this field.\n"
27 },
28 "fullName": {
29 "type": ["string", "null"],
30 "description": "Customer name, when available."
31 },
32 "email": {
33 "type": ["string", "null"],
34 "format": "email",
35 "description": "Customer email, when available."
36 },
37 "totalMoney": {
38 "type": "number",
39 "format": "double",
40 "description": "Total purchase amount associated with the Order."
41 }
42 }
43}
44