Package-level declarations

Types

Link copied to clipboard
fun interface BuyerNotifications

How buyers are told about their orders: a mail or push service outside Wow. A port of the ShipmentNotifier, which the server binds to that service and a test fakes.

Link copied to clipboard
@Description(value = "A buyer's order, from its submission to its shipment")
class Order(state: OrderState)

A buyer's order and its state machine, after the classic eShop's:

Link copied to clipboard

The order process, after the classic eShop's OrderProcessor: it drives an order through the stock validation in the inventory context, and compensates when the inventory refuses.

Link copied to clipboard

The state of an Order, changed in place by its events. Every property has a value before the order is submitted: the kernel serializes the state as it is.

Link copied to clipboard
fun interface OrderSummaries

Where the order summaries are kept: a table, a document collection, a search index. A port of the OrderSummaryProjection, which the server binds to its store and a test fakes.

Link copied to clipboard
data class OrderSummary(val tenantId: String, val orderId: String, val buyerId: String?, val status: OrderStatus, val totalAmount: BigDecimal, val units: Int, val updatedAt: Long)

One line of a buyer's order history: an order as its buyer lists them, by the time it last changed. The OrderSummaryProjection writes it from the order's commits; the history page reads it from the store the OrderSummaries are kept in, which holds no event and no state of the aggregate.

Link copied to clipboard

Keeps each order's OrderSummary in OrderSummaries after every commit of the order, from the state after it. A projection starts at the beginning of the log, so a service that adds it fills the history of the orders submitted before. Its store is outside Wow, so its write blocks a virtual thread rather than the shared workers.

Link copied to clipboard
data class PaymentPolicy(val gracePeriod: Duration)

How long an order whose stock is confirmed waits for its payment before it cancels itself: its gracePeriod. A domain service of the order's command functions, so the server binds it once from its configuration and a test gives it its own.

Link copied to clipboard
@Retry(maxAttempts = 5, initialBackoff = "1s", maxBackoff = "30s", timeout = "10s", unrecoverable = [UnknownBuyerException::class])
class ShipmentNotifier(notifications: BuyerNotifications)

Tells the buyer of a shipped order that it is on its way. The notification service is a remote call that may be slow or briefly down, so the reactor gives it its own budget: five attempts, from one second apart up to thirty, and ten seconds for each, before the order is parked for the handler in the failure ledger. A buyer the service does not know is a failure no retry can fix, so it parks the order at once.

Link copied to clipboard

The notification service has no buyer buyerId: asking again does not help.