本文整理汇总了Java中backtype.storm.task.OutputCollector.emit方法的典型用法代码示例。如果您正苦于以下问题:Java OutputCollector.emit方法的具体用法?Java OutputCollector.emit怎么用?Java OutputCollector.emit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.task.OutputCollector
的用法示例。
在下文中一共展示了OutputCollector.emit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: emitTsdbMap
import backtype.storm.task.OutputCollector; //导入方法依赖的package包/类
private boolean emitTsdbMap(String tsdbStreamId, String transferStreamId, OutputCollector collector,
Map<String, Long> tsdbMap, Map<String, Long> channelCountMap){
/**
* emit date in opentsdb-map to write-opentsdb-bold as a stream
*/
for (String tsdbKey : tsdbMap.keySet()){
String[] params = tsdbKey.split("#");
String channel = params[0];
String code = params[1];
long timestamp = (Long.valueOf(params[2]))*300;
Long total = channelCountMap.get(channel);
if (total == null){
logger.error("compute channel count wrong : " + channel);
continue;
}
double num = (tsdbMap.get(tsdbKey));
double ratio = num/total;
//future : separate transfer stream from tsdb stream
collector.emit(tsdbStreamId, new Values(channel, code, timestamp, num, ratio));
collector.emit(transferStreamId, new Values(channel, code, timestamp, num, ratio));
logger.debug(channel + "-" + code + ":" + num + "-" + ratio);
}
return true;
}
示例2: emitHbaseMap
import backtype.storm.task.OutputCollector; //导入方法依赖的package包/类
private boolean emitHbaseMap(String streamId, OutputCollector collector,
Map<String, Map<String,String>> hbaseMap){
for (String rowKey : hbaseMap.keySet()){
Map<String, String> rowMap = hbaseMap.get(rowKey);
for (String column : rowMap.keySet()){
collector.emit(streamId, new Values(rowKey, column, rowMap.get(column)));
logger.debug("emit hbase date" + hbaseMap.toString());
}
}
return true;
}