12 Real-world example: An Akka betting house

 

This chapter covers

  • Creating an elaborate use case
  • Creating the entities and ports for them

This chapter presents a real-world example. The functionality is only part of a large business use case: sports betting. The idea is to create three actors at the business’s core:

  • The market is a sporting event with specific odds that can be bet against. For example, the Liverpool vs. Real Madrid soccer match has a market where bets can be placed on a home win, an away win, or a draw.
  • The wallet represents a user’s account with their balance.
  • The bet is the amount of money invested in a market and secured by a wallet.

These entities reside in a cluster, so they can communicate directly. To communicate with them from the outside, the application has ports: two gRPC services and one Akka HTTP service. Figure 12.1 shows the big picture of how everything is related.

Figure 12.1 Big picture of the example application
CH12_F01_Abraham2

This example is just the first step to give you insight into the process of beginning a professional project, including how to get started and what to focus on. Like any project, it will evolve later, further splitting some boundaries and blending others. So, the actors will also evolve. Let’s look at the definition of the actors and their protocols.

12.1 The actors

 

12.1.1 The wallet

 
 
 
 

12.1.2 The market

 
 
 
 

12.1.3 The bet

 
 
 
 

12.2 The ports

 

12.2.1 The market

 

Summary

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest