Java Code Examples for backtype.storm.tuple.Tuple#getValues()
The following examples show how to use
backtype.storm.tuple.Tuple#getValues() .
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: ThroughputHostsTracking.java From flink-perf with Apache License 2.0 | 6 votes |
@Override public void execute(Tuple input) { if(withFt) { // anchor the output on the only input element (we pass through) List<Object> vals = input.getValues(); Long v = (Long) vals.get(0); v++; vals.set(0, v); ((List<String>)vals.get(4)).add(host); collector.emit(input, vals); // acknowledge the element upstream. collector.ack(input); } else { // unanchored pass forward collector.emit(input.getValues()); } }
Example 2
Source File: Throughput.java From flink-perf with Apache License 2.0 | 6 votes |
@Override public void execute(Tuple input) { List<Object> vals = input.getValues(); Long v = (Long) vals.get(0); v++; vals.set(0, v); if(withFt) { // anchor the output on the only input element (we pass through) collector.emit(input, vals); // acknowledge the element upstream. collector.ack(input); } else { // unanchored pass forward collector.emit(input.getValues()); } }
Example 3
Source File: BoltExecutors.java From jstorm with Apache License 2.0 | 6 votes |
private void processTupleBatchEvent(Tuple tuple) { try { if ((!isSystemBolt && tuple.getSourceStreamId().equals(Common.TOPOLOGY_MASTER_CONTROL_STREAM_ID)) || tuple.getSourceStreamId().equals(Common.TOPOLOGY_MASTER_REGISTER_METRICS_RESP_STREAM_ID)) { if (tuple.getValues().get(0) instanceof Pair) { for (Object value : tuple.getValues()) { Pair<MessageId, List<Object>> val = (Pair<MessageId, List<Object>>) value; TupleImplExt t = new TupleImplExt( sysTopologyCtx, val.getSecond(), val.getFirst(), ((TupleImplExt) tuple)); processTupleEvent(t); } } } else { bolt.execute(tuple); } } catch (Throwable e) { error = e; LOG.error("bolt execute error ", e); reportError.report(e); } }
Example 4
Source File: TupleTransform.java From PoseidonX with Apache License 2.0 | 5 votes |
/** * 从Storm的Tuple事件转换为内部事件类型IEvent * <功能详细描述> */ public IEvent getEvent(Tuple tuple) throws StreamSerDeException { List<Object> value = tuple.getValues(); return new TupleEvent(tuple.getSourceStreamId(), iEventType, value.toArray(new Object[value.size()])); }
Example 5
Source File: CounterBolt.java From storm-kafka-examples with Apache License 2.0 | 5 votes |
@Override public void execute(Tuple tuple, BasicOutputCollector collector) { List<Object> data = tuple.getValues(); String id = (String) data.get(0); String memberid = (String) data.get(1); String totalprice = (String) data.get(2); String preprice = (String) data.get(3); String sendpay = (String) data.get(4); String createdate = (String) data.get(5); collector.emit(new Values(id,memberid,totalprice,preprice,sendpay,createdate)); logger.info("+++++++++++++++++++++++++++++++++Valid+++++++++++++++++++++++++++++++++"); logger.info("msg = "+data+" ----@-@-@-@-@--------counter = "+(counter++)); logger.info("+++++++++++++++++++++++++++++++++Valid+++++++++++++++++++++++++++++++++"); }
Example 6
Source File: FastWordCountTopNWindowTopology.java From jstorm with Apache License 2.0 | 5 votes |
@Override public void execute(Tuple tuple, Object state, TimeWindow window) { LOG.info("executing on window:{}", window); Map<String, Integer> counts = (Map<String, Integer>) state; List<Object> partialWordCounts = tuple.getValues(); for (Object partialWordCount : partialWordCounts) { Pair<String, Integer> pair = (Pair<String, Integer>) partialWordCount; counts.put(pair.getFirst(), pair.getSecond()); } }
Example 7
Source File: TupleTransform.java From PoseidonX with Apache License 2.0 | 4 votes |
/** * 将tuple转换为内部使用的tupleEvent * TODO 该方法为静态方法,和使用对象进行转换的性能哪个好还有待进一步验证 */ public static TupleEvent tupeToEvent(Tuple input, IEventType inputTupleEventType) { List<Object> value = input.getValues(); return new TupleEvent(input.getSourceStreamId(), inputTupleEventType, value.toArray(new Object[value.size()])); }