This project is a simple basketball game event streaming service. It reads game events data from sample files, decodes the hexadecimal data and processes each event to simulate a real-time game event stream. The motivation behind this design is to ensure the quickest delivery and processing of game event data. This realtime processing is crucial in contexts where it's essential to make immediate decisions based on the streamed data, such as in live betting, real-time analytics, or immediate fan engagement.
The logic of the application is controlled from the GameController. Here is a step-by-step overview of how it operates:
-
GameControllerinvokesDataControllerto fetch data from the provided sample data. The data returned byDataControlleris a list of integers representing hexadecimal values. -
This data is then forwarded to
EventControllerfor decoding. -
EventControllertakes each hexadecimal value and decodes them intoEventinstances. -
The decoded
Eventdata is then sent back toGameController. -
GameControllerperforms validation on eachEventagainst previously stored events. For instance, an event is considered valid if its match time is later than previous events and it maintains logical point progression (e.g., the points are within a valid range). -
Valid events are then added to an event store for further processing.
For event storage, the system uses a List[Event] where events are prepended to the list as it offers efficient, near-constant time, append operation. As a result, the events are stored effectively in a reverse order. When we retrieve the events, we just reverse the list which gives us all events in the order they occurred.
sbt 'run sample1'
sbt 'run sample2'
sbt test