O'Reilly logo

Learning Storm by Anand Nalya, Ankit Jain

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

Maintaining the topology state with Trident

Trident provides an abstraction for reading from and writing results to stateful sources. We can maintain the state either internal to the topology (memory) or can store this in external sources (Memcached or Cassandra).

Let's consider that we are maintaining the output of the preceding sample Trident topology in a database. Every time you process a tuple, the count of country present in a tuple increases in the database. However, by maintaining the count in the database, we can't achieve exactly one processing. The reason is that if any tuple fails during processing, then the failed tuple is retried. This creates a problem while updating the state because we are not sure whether the state of this tuple ...

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