Implementing the architecture
Let's now delve into the details of the implementation. For example purposes, the following code assumes the topology is running locally. We use an in-memory queue instead of a persistent queue, and a hash map as our storage mechanism. In a real production implementation, we would most likely use a durable queuing system such as Kafka and a distributed storage mechanism such as Cassandra.
The data model
We will look at each of the topologies in depth, but first, let's have a look at the data model. To simplify things, we've encapsulated the game logic and the data model into two classes: Board
and GameState
.
The following is a listing of the Board
class:
public class Board implements Serializable { public static final ...
Get Storm Blueprints: Patterns for Distributed Real-time Computation now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.