Adjusted "cargo shipping" example (underscore method names).
@@ -222,7 +222,7 @@ class Cargo(Aggregate):
destination: Location
@when.register
- def destination_changed(self, event: DestinationChanged) -> None:
+ def _(self, event: DestinationChanged) -> None:
self._destination = event.destination
def assign_route(self, itinerary: Itinerary) -> None:
@@ -232,7 +232,7 @@ class Cargo(Aggregate):
route: Itinerary
@when.register
- def route_assigned(self, event: RouteAssigned) -> None:
+ def _(self, event: RouteAssigned) -> None:
self._route = event.route
self._routing_status = "ROUTED"
self._estimated_time_of_arrival = Cargo.Event.create_timestamp() + timedelta(
@@ -263,7 +263,7 @@ class Cargo(Aggregate):
handling_activity: str
@when.register
- def handling_event_registered(self, event: HandlingEventRegistered) -> None:
+ def _(self, event: HandlingEventRegistered) -> None:
assert self.route is not None
if event.handling_activity == HandlingActivity.RECEIVE:
self._transport_status = "IN_PORT"
