Now that we have events being generated, the next step is to add the logic components that implement the business process. In Trident, these are known as operations. In our topology, we are using two different types of operations: filters and functions.
Operations are applied to streams via methods on the Stream
object. In this example, we use the following methods on the Stream
object:
public class Stream implements IAggregatableStream { public Stream each(Fields inputFields, Filter filter) { ... } public IAggregatableStream each(Fields inputFields, Function function, Fields functionFields){ ... } public GroupedStream groupBy(Fields fields) { ... } public TridentState persistentAggregate( StateFactory stateFactory, CombinerAggregator agg, Fields functionFields) { ... } }
Note that the methods in the preceding code return forms of the Stream
objects or TridentState
that can be used to create additional streams. With...