Skip to content

Commit

Permalink
Turn OrderPaid event into record.
Browse files Browse the repository at this point in the history
  • Loading branch information
odrotbohm committed May 23, 2024
1 parent 109a22b commit 28ddb68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.springframework.modulith.events.ApplicationModuleListener;
import org.springframework.stereotype.Service;
import org.springsource.restbucks.order.Order;
import org.springsource.restbucks.order.OrderPaid;
import org.springsource.restbucks.order.Order.OrderPaid;
import org.springsource.restbucks.order.Orders;

/**
Expand All @@ -48,7 +48,7 @@ class Engine {
@ApplicationModuleListener
public void handleOrderPaidEvent(OrderPaid event) {

var order = orders.markInPreparation(event.getOrderId());
var order = orders.markInPreparation(event.orderIdentifier());
var processingTime = settings.getProcessingTime();

ordersInProgress.add(order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.javamoney.moneta.Money;
import org.jmolecules.ddd.types.AggregateRoot;
import org.jmolecules.ddd.types.Identifier;
import org.jmolecules.event.types.DomainEvent;
import org.springframework.data.domain.AbstractAggregateRoot;
import org.springsource.restbucks.drinks.Drink;
import org.springsource.restbucks.order.Order.OrderIdentifier;
Expand Down Expand Up @@ -228,4 +229,12 @@ public static enum Status {
}

public record OrderIdentifier(UUID id) implements Identifier {}

/**
* Event to be thrown when an {@link Order} has been paid.
*
* @author Oliver Gierke
* @author Stéphane Nicoll
*/
public record OrderPaid(OrderIdentifier orderIdentifier) implements DomainEvent {}
}

This file was deleted.

0 comments on commit 28ddb68

Please sign in to comment.