Search in sources :

Example 1 with LoggingFilter

use of org.apache.storm.eventhubs.samples.TransactionalTridentEventCount.LoggingFilter in project storm by apache.

the class OpaqueTridentEventCount method buildTopology.

@Override
protected StormTopology buildTopology(EventHubSpout eventHubSpout) {
    TridentTopology topology = new TridentTopology();
    OpaqueTridentEventHubSpout spout = new OpaqueTridentEventHubSpout(spoutConfig);
    TridentState state = topology.newStream("stream-" + spoutConfig.getTopologyName(), spout).parallelismHint(spoutConfig.getPartitionCount()).aggregate(new Count(), new Fields("partial-count")).persistentAggregate(new MemoryMapState.Factory(), new Fields("partial-count"), new Sum(), new Fields("count"));
    state.newValuesStream().each(new Fields("count"), new LoggingFilter("got count: ", 10000));
    return topology.build();
}
Also used : Fields(org.apache.storm.tuple.Fields) TridentTopology(org.apache.storm.trident.TridentTopology) OpaqueTridentEventHubSpout(org.apache.storm.eventhubs.trident.OpaqueTridentEventHubSpout) TridentState(org.apache.storm.trident.TridentState) MemoryMapState(org.apache.storm.trident.testing.MemoryMapState) LoggingFilter(org.apache.storm.eventhubs.samples.TransactionalTridentEventCount.LoggingFilter) Sum(org.apache.storm.trident.operation.builtin.Sum) Count(org.apache.storm.trident.operation.builtin.Count)

Aggregations

LoggingFilter (org.apache.storm.eventhubs.samples.TransactionalTridentEventCount.LoggingFilter)1 OpaqueTridentEventHubSpout (org.apache.storm.eventhubs.trident.OpaqueTridentEventHubSpout)1 TridentState (org.apache.storm.trident.TridentState)1 TridentTopology (org.apache.storm.trident.TridentTopology)1 Count (org.apache.storm.trident.operation.builtin.Count)1 Sum (org.apache.storm.trident.operation.builtin.Sum)1 MemoryMapState (org.apache.storm.trident.testing.MemoryMapState)1 Fields (org.apache.storm.tuple.Fields)1