EMIL process representation
@MessageListener(processes = OrderPlacement.class)
@ProducesEvent(OrderCreated.class)
public Root buildPlacedOrder(OrderPlaced event) {
OrderDescription description = event.description().value();
OrderId id = new OrderId(event.productId().value(),
description.customerId(), description.reference());
Root order = newAggregateWithId(id);
order.attributes().units().value(description.units());
return order;
}
Message listener implementation
Process graph
Message handling in a Pousse-Café runtime
"Compute aggregate identifiers to update"; // Code actually written
while("all identifiers are not handled") {
"Start transaction";
"Fetch aggregate to update";
"Execute update listener"; // Code actually written
"Update aggregate;"
"End transaction";
}
Algorithm describing aggregate(s) update upon message consumption
Collision handling
Static class diagram for a sample aggregate root
Static class diagram for sample command and domain event
Generate your first Pousse-Café project (do not forget to replace archetype version with the
latest ):
mvn archetype:generate -B -DarchetypeGroupId=org.pousse-cafe-framework -DarchetypeArtifactId=pousse-cafe-sample-app-archetype -DarchetypeVersion=$ARCHETYPE_VERSION -DgroupId=test -DartifactId=test -Dversion=0.0.0-SNAPSHOT
OR...