O'Reilly logo

Storm Blueprints: Patterns for Distributed Real-time Computation by Brian O'Neill, P. Taylor Goetz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required