本文整理匯總了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;
}