本文整理了Java中backtype.storm.tuple.Tuple.getIntegerByField()
方法的一些代码示例,展示了Tuple.getIntegerByField()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple.getIntegerByField()
方法的具体详情如下:
包路径:backtype.storm.tuple.Tuple
类名称:Tuple
方法名:getIntegerByField
暂无
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
//Integer count = 30;
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: udacity/ud381
@Override
public void execute(Tuple tuple)
{
// access the first column 'word'
String word = tuple.getStringByField("word");
// access the second column 'count'
Integer count = tuple.getIntegerByField("count");
// publish the word count to redis using word as the key
redis.publish("WordCountTopology", word + "|" + Long.toString(count));
}
代码示例来源:origin: mayconbordin/storm-applications
@Override
public void execute(Tuple input) {
int statusCode = input.getIntegerByField(Field.RESPONSE);
int count = 0;
if (counts.containsKey(statusCode)) {
count = counts.get(statusCode);
}
count++;
counts.put(statusCode, count);
collector.emit(input, new Values(statusCode, count));
collector.ack(input);
}
代码示例来源:origin: XavientInformationSystems/Data-Ingestion-Platform
private Map<String, Integer> groupByField(List<Tuple> tuples, String field) {
Map<String, Integer> counts = new HashMap<>();
for (Tuple tuple : tuples) {
if (counts.containsKey(tuple.getStringByField(field))) {
counts.put(tuple.getStringByField(field), counts.get(tuple.getStringByField(field)) + 1);
} else {
counts.put(tuple.getStringByField(field), tuple.getIntegerByField("count"));
}
collector.ack(tuple);
}
return counts;
}
代码示例来源:origin: MrChrisJohnson/CollabStream
public void execute(Tuple tuple) {
String line = tuple.getStringByField("line");
Integer lineNum = tuple.getIntegerByField("lineNum");
System.out.println("######## CounterBolt.execute: " + lineNum + ". " + line);
lineNumSet.add(lineNum);
collector.emit(tuple, new Values(lineNum));
collector.ack(tuple);
}
代码示例来源:origin: XavientInformationSystems/Data-Ingestion-Platform
@Override
protected void finishBatch() {
List<Tuple> _tuples = new ArrayList<Tuple>();
queue.drainTo(_tuples);
Set<Tuple> tuples = new TreeSet<>(new TuplesOrdering("userFollowersCount"));
tuples.addAll(_tuples);
tuples = tuples.size() > rankMaxThreshold ? ImmutableSet.copyOf(Iterables.limit(tuples, rankMaxThreshold))
: tuples;
for (Tuple tuple : tuples)
collector.emit(
new Values(tuple.getStringByField("username"), tuple.getIntegerByField("userFollowersCount")));
}
代码示例来源:origin: XavientInformationSystems/Data-Ingestion-Platform
@Override
protected void finishBatch() {
List<Tuple> _tuples = new ArrayList<Tuple>();
queue.drainTo(_tuples);
Set<Tuple> tuples = new TreeSet<>(new TuplesOrdering("followersCount"));
tuples.addAll(_tuples);
tuples = tuples.size() > rankMaxThreshold ? ImmutableSet.copyOf(Iterables.limit(tuples, rankMaxThreshold))
: tuples;
for (Tuple tuple : tuples) {
collector.emit(new Values("user_followers", tuple.getStringByField("username"),
tuple.getIntegerByField("followersCount")));
collector.ack(tuple);
}
}
代码示例来源:origin: calrissian/flowmix
public FlowInfo(Tuple tuple) {
flowId = tuple.getStringByField(FLOW_ID);
event = (Event) tuple.getValueByField(EVENT);
idx = tuple.getIntegerByField(FLOW_OP_IDX);
idx++;
streamName = tuple.getStringByField(STREAM_NAME);
previousStream = tuple.getStringByField(LAST_STREAM);
if(tuple.contains(PARTITION))
partition = tuple.getStringByField(PARTITION);
}
内容来源于网络,如有侵权,请联系作者删除!