本文整理汇总了Java中storm.trident.tuple.TridentTuple.getStringByField方法的典型用法代码示例。如果您正苦于以下问题:Java TridentTuple.getStringByField方法的具体用法?Java TridentTuple.getStringByField怎么用?Java TridentTuple.getStringByField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类storm.trident.tuple.TridentTuple
的用法示例。
在下文中一共展示了TridentTuple.getStringByField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isKeep
import storm.trident.tuple.TridentTuple; //导入方法依赖的package包/类
@Override
public boolean isKeep(TridentTuple tuple) {
String mac = tuple.getStringByField("src_mac");
boolean status = true;
if(mac!=null) {
String macSplit[] = mac.split(":");
String macHex = macSplit[0];
// if (_debug)
// System.out.println("HEX: " + macHex);
String binary = hexToBin(macHex);
if (binary.endsWith("10") || binary.endsWith("11"))
status = false;
// if (_debug) {
// System.out.println("BIN: " + binary);
// System.out.println("TRUE/FALSE: " + status);
// }
}
return status;
}
示例2: execute
import storm.trident.tuple.TridentTuple; //导入方法依赖的package包/类
@Override
public void execute(TridentTuple tuple,
TridentCollector collector) {
// TODO Auto-generated method stub
String currentThreadName = Thread.currentThread().getName();
String randomPhrase = tuple.getStringByField("randomPhrase");
CommonUtil.logMessage(logger, currentThreadName, "execute: entered with tuple = %s", randomPhrase);
StringTokenizer st = new StringTokenizer(randomPhrase);
while(st.hasMoreTokens())
{
String token = st.nextToken();
List<Object> tupleList = new ArrayList<>();
tupleList.add(token);
CommonUtil.logMessage(logger, currentThreadName, "execute: emitting tuple with word = %s", token);
collector.emit(tupleList);
}
}
示例3: sendToSiddhi
import storm.trident.tuple.TridentTuple; //导入方法依赖的package包/类
public void sendToSiddhi(TridentTuple tuple) {
String section = tuple.getStringByField("sections");
Map<String, Object> map = (Map<String, Object>) tuple.getValueByField("maps");
for (int i = 0; i < _inputsHandler.get(section).size(); i++) {
try {
_inputsHandler.get(section).get(i).send(mapToArray(map, section, i).toArray());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
示例4: execute
import storm.trident.tuple.TridentTuple; //导入方法依赖的package包/类
@Override
public void execute(TridentTuple tuple,
TridentCollector collector) {
// TODO Auto-generated method stub
String currentThreadName = Thread.currentThread().getName();
String randomPhrase = tuple.getStringByField("randomPhrase");
CommonUtil.logMessage(logger, currentThreadName, "execute: entered with tuple = %s", randomPhrase);
//Eliminate stop words and punctuation like comma , double quotes - use Lucene
List<String> filteredFailedPhrase = Util.filterPhrase2(randomPhrase);
CommonUtil.logMessage(logger, currentThreadName, "execute: filteredFailedPhraseList = %s", filteredFailedPhrase);
for(String eachWord : filteredFailedPhrase)
{
List<Object> tupleList = new ArrayList<>();
tupleList.add(eachWord);
CommonUtil.logMessage(logger, currentThreadName, "execute: emitting tuple with word = %s", eachWord);
collector.emit(tupleList);
}
}