Java Code Examples for org.apache.storm.tuple.Tuple#getLong()
The following examples show how to use
org.apache.storm.tuple.Tuple#getLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RollingCountAggBolt.java From storm_spring_boot_demo with MIT License | 6 votes |
@Override public void execute(Tuple tuple) { Object obj = tuple.getValue(0); long count = tuple.getLong(1); int source = tuple.getSourceTask(); Map<Integer, Long> subCounts = counts.get(obj); if (subCounts == null) { subCounts = new HashMap<Integer, Long>(); counts.put(obj, subCounts); } //Update the current count for this object subCounts.put(source, count); //Output the sum of all the known counts so for this key long sum = 0; for (Long val: subCounts.values()) { sum += val; } collector.emit(new Values(obj, sum)); }
Example 2
Source File: RollingCountAggBolt.java From storm-net-adapter with Apache License 2.0 | 6 votes |
@Override public void execute(Tuple tuple) { Object obj = tuple.getValue(0); long count = tuple.getLong(1); int source = tuple.getSourceTask(); Map<Integer, Long> subCounts = counts.get(obj); if (subCounts == null) { subCounts = new HashMap<Integer, Long>(); counts.put(obj, subCounts); } //Update the current count for this object subCounts.put(source, count); //Output the sum of all the known counts so for this key long sum = 0; for (Long val : subCounts.values()) { sum += val; } collector.emit(new Values(obj, sum)); }
Example 3
Source File: ABolt.java From chuidiang-ejemplos with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { long now = tuple.getLong(0); long offset = now-lastNow; lastNow = now; int value = tuple.getInteger(1); sum += value; collector.emit(new Values(offset,sum)); log.info("data results emitted"); }
Example 4
Source File: PerformanceTestTopology.java From jstorm with Apache License 2.0 | 4 votes |
public void execute(Tuple input) { long count = input.getLong(0); collector.ack(input); }