com.lambdaworks.redis.RedisConnection.publish()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中com.lambdaworks.redis.RedisConnection.publish方法的一些代码示例,展示了RedisConnection.publish的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisConnection.publish方法的具体详情如下:
包路径:com.lambdaworks.redis.RedisConnection
类名称:RedisConnection
方法名:publish

RedisConnection.publish介绍

暂无

代码示例

代码示例来源:origin: udacity/ud381

@Override
public void execute(Tuple tuple)
{
 // access the first column 'word'
 //String word = tuple.getStringByField("word");
 String word = (String) tuple.getValue(0);
 // 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)
{
 // get the column word from tuple
 String word = tuple.getString(0);
 // build the word with the exclamation marks appended
 StringBuilder exclamatedWord = new StringBuilder();
 exclamatedWord.append(word).append("!!!");
 // emit the word with exclamations
 _collector.emit(tuple, new Values(exclamatedWord.toString()));
 //********* ADDED 4-of-4 redis reporter
 long count = 30;
 redis.publish("WordCountTopology", exclamatedWord.toString() + "|" + Long.toString(count));
 //********* END 4-of-4
}

代码示例来源: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)
{
 // get the column word from tuple
 String word = tuple.getString(0);
 // build the word with the exclamation marks appended
 StringBuilder exclamatedWord = new StringBuilder();
 exclamatedWord.append(word).append("!!!");
 // emit the word with exclamations
 _collector.emit(tuple, new Values(exclamatedWord.toString()));
 //********* ADDED 4-of-4 redis reporter
 long count = 30;
 redis.publish("WordCountTopology", exclamatedWord.toString() + "|" + Long.toString(count));
 //********* END 4-of-4
}

代码示例来源: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: udacity/ud381

@Override
public void execute(Tuple tuple)
{
 Rankings rankableList = (Rankings) tuple.getValue(0);
 for (Rankable r: rankableList.getRankings()){
  String word = r.getObject().toString();
  Long count = r.getCount();
  redis.publish("WordCountTopology", word + "|" + Long.toString(count));
 }
 // access the first column 'word'
 //String word = tuple.getStringByField("word");
 // access the second column 'count'
 //String word = rankedWords.toString();
 //Integer count = tuple.getIntegerByField("count");
 //Long count = new Long(100);
 // publish the word count to redis using word as the key
 //redis.publish("WordCountTopology", word + ":" + Long.toString(count));
}

相关文章