EAI Patterns with Actor Model: Aggregator

The Recipient List example didn’t demonstrate how the PriceQuote replies are assimilated by the MountaineeringSuppliesOrderProcessor. To correlate PriceQuote replies to the original RequestForQuotation we need to use the unique rfqId that has been passed along with each message:

orderProcessor ! RequestForQuotation("123", ...)
...
recipient ! RequestPriceQuote(rfq.rfqId, ...)
...
sender ! PriceQuote(rpq.rfqId, ...)

The previous example from Recipient List is extended here to include an Aggregator, which tracks the fulfillment of all requested price quotes. First note the new message types:

case class PriceQuoteFulFilled(priceQuote: PriceQuote)

case class RequiredPriceQuotesForFulfillment(rfqId: String, quotesRequested: Int)

case class QuotationFulfillment(rfqId: String, quotesRequested: Int, priceQuotes: Seq[PriceQuote], requester: ActorRef)
. . .

The full text is now available as part of my book Reactive Enterprise with Actor Model on Safari Books Online.

More to explore

Reactive DDD: Modeling Uncertainty

Domain-Driven Design supports reactive architecture and programming. Still, reactive introduces uncertainty. Back in 2003, the way that Domain-Driven Design was used and

Scroll to Top