Now that we have the counts for each aggregation, we want to persist with that information for further analysis. In Trident, persistence first starts with state management. Trident has a first-level primitive for state, but like the Storm API, it makes a few assumptions about what is being stored as state or how that state is persisted. At the highest level, Trident exposes a State
interface as follows:
public interface State { void beginCommit(Long transactionId); void commit(Long transactionId); }
As mentioned previously, Trident groups tuples into batches. Each batch has its own transaction identifier. In the preceding interface, Trident informs the State
object when the state is being committed and when the commit should complete.
Like functions, there are methods on the Stream
objects that introduce state-based operations into a topology. More specifically, there are two types of streams in Trident: Stream
and GroupedStream
. A GroupedStream
is the result...