當前位置: 首頁>>代碼示例>>Java>>正文


Java TridentTuple.getValueByField方法代碼示例

本文整理匯總了Java中storm.trident.tuple.TridentTuple.getValueByField方法的典型用法代碼示例。如果您正苦於以下問題:Java TridentTuple.getValueByField方法的具體用法?Java TridentTuple.getValueByField怎麽用?Java TridentTuple.getValueByField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在storm.trident.tuple.TridentTuple的用法示例。


在下文中一共展示了TridentTuple.getValueByField方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateState

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void updateState(MapState<Map<String, Object>> state, List<TridentTuple> tuples, TridentCollector collector) {
    List<Map<String, Object>> events = new ArrayList<>();
    List<List<Object>> keys = new ArrayList<>();
    for (TridentTuple t : tuples) {
        if (t != null) {
            List<Object> l = new ArrayList<>();
            l.add(_generalKey + t.getValueByField(_key));
            keys.add(l);
            if (t.getValueByField(_value) != null)
                events.add((Map<String, Object>) t.getValueByField(_value));

            if (_debug) {
                System.out.println("SAVED TO RIAK KEY: " + _generalKey + t.getValueByField(_key)
                        + " VALUE: " + t.getValueByField(_value));
            }
        }
    }

    try {
        if (!events.isEmpty())
            state.multiPut(keys, events);
    } catch (ReportedFailedException e) {
        Logger.getLogger(RiakUpdater.class.getName()).log(Level.WARNING, null, e);
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:27,代碼來源:RiakUpdater.java

示例2: 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();
            }
        }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:12,代碼來源:SiddhiState.java

示例3: init

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public PriorityQueue init(Object batchId, TridentCollector collector) {
    return new PriorityQueue(_n, new Comparator<TridentTuple>() {
        @Override
        public int compare(TridentTuple t1, TridentTuple t2) {
            Comparable c1 = (Comparable) t1.getValueByField(_sortField);
            Comparable c2 = (Comparable) t2.getValueByField(_sortField);
            int ret = c1.compareTo(c2);
            if(_reverse) ret *= -1;
            return ret;
        }                
    });
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:14,代碼來源:FirstN.java

示例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();
	TupleDS tupleDs = (TupleDS)tuple.getValueByField("myTuple");
	CommonUtil.logMessage(logger, currentThreadName, "execute: entered with tuple %s", tupleDs);
	
	int field1 = tupleDs.getField1();
	int field2 = tupleDs.getField2();

	
	if(field1 == 0 && field2 == 0)
	{
		/**
		 * Transaction is a success. Means the entire batch should contain tuples which fulfill this criteria.
		 */
		
	}
	else if(field1 == 0 && field2 == 1)
	{
		/**
		 * Fail the transaction.
		 */
		throw new FailedException("Throwing FAILEDEXCEPTION");
	}
	
}
 
開發者ID:BinitaBharati,項目名稱:storm-trident-example,代碼行數:29,代碼來源:Function.java

示例5: init

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public PriorityQueue init(Object batchId, TridentCollector collector) {
    return new PriorityQueue(_n, new Comparator<TridentTuple>() {
        @Override
        public int compare(TridentTuple t1, TridentTuple t2) {
            Comparable c1 = (Comparable) t1.getValueByField(_sortField);
            Comparable c2 = (Comparable) t2.getValueByField(_sortField);
            int ret = c1.compareTo(c2);
            if (_reverse)
                ret *= -1;
            return ret;
        }
    });
}
 
開發者ID:kkllwww007,項目名稱:jstrom,代碼行數:15,代碼來源:FirstN.java

示例6: getKeyFromTuple

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public K getKeyFromTuple(TridentTuple tuple) {
    return (K) tuple.getValueByField(keyFieldName);
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:5,代碼來源:FieldNameBasedTupleToKafkaMapper.java

示例7: getMessageFromTuple

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public V getMessageFromTuple(TridentTuple tuple) {
    return (V) tuple.getValueByField(msgFieldName);
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:5,代碼來源:FieldNameBasedTupleToKafkaMapper.java

示例8: execute

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
@Override
public void execute(TridentTuple tuple, TridentCollector tridentCollector) {
    Map<String, Object> mseEvent = (Map<String, Object>) tuple.getValueByField("mse_map");
    if (mseEvent != null) {
        Map<String, Object> cacheLocation = (Map<String, Object>) tuple.getValueByField("mseMap");
        mseEventContent = (Map<String, Object>) mseEvent.get("StreamingNotification");
        location = (Map<String, Object>) mseEventContent.get("location");
        Map<String, Object> druid = new HashMap<>();

        if (location != null) {
            mapInfo = (Map<String, Object>) location.get("MapInfo");
            if (mapInfo == null) {
                mapInfo = (Map<String, Object>) location.get("mapInfo");
            }

            String mapHierachy = (String) mapInfo.get("mapHierarchyString");
            if (mapHierachy != null) {
                String[] zone = mapHierachy.split(">");
                String wirelessStation = (String) location.get("apMacAddress");

                if(wirelessStation==null){
                    wirelessStation = "unknown";
                }

               // System.out.println("CACHE: " + cacheLocation);
                if (!cacheLocation.isEmpty()) {
                    String oldFloor = (String) cacheLocation.get("client_floor");
                    String oldBuilding = (String) cacheLocation.get("client_building");
                    String oldCampus = (String) cacheLocation.get("client_campus");
                    String oldwirelessStation = (String) cacheLocation.get("wireless_station");

                    if (oldFloor != null)
                        if (!oldFloor.equals(zone[2])) {
                            druid.put("client_floor_old", oldFloor);
                            druid.put("client_floor_new", zone[2]);
                        } else {
                            druid.put("client_floor", zone[2]);
                        }

                    if (oldwirelessStation != null)
                        if (!oldwirelessStation.equals(wirelessStation)) {
                            druid.put("wireless_station_old", oldwirelessStation);
                            druid.put("wireless_station_new", wirelessStation);
                        } else {
                            druid.put("wireless_station", wirelessStation);
                        }

                    if (oldBuilding != null)
                        if (!oldBuilding.equals(zone[1])) {
                            druid.put("client_building_old", oldBuilding);
                            druid.put("client_building_new", zone[1]);
                        } else {
                            druid.put("client_building", zone[1]);
                        }

                    if (oldCampus != null)
                        if (!oldCampus.equals(zone[0])) {
                            druid.put("client_campus_old", oldCampus);
                            druid.put("client_campus_new", zone[0]);
                        } else {
                            druid.put("client_campus", zone[0]);
                        }

                } else {
                    druid.put("client_floor_new", zone[2]);
                    druid.put("client_campus_new", zone[0]);
                    druid.put("client_building_new", zone[1]);
                }
            }

            String macAddress = (String) location.get("macAddress");
            String timestamp = (String) mseEvent.get("timestamp");

            druid.put("sensor_name", mseEventContent.get("subscriptionName"));
            druid.put("timestamp", new DateTime(timestamp).withZone(DateTimeZone.UTC).getMillis() / 1000);
            druid.put("client_mac", macAddress);
            tridentCollector.emit(new Values(druid));
        }
    }
}
 
開發者ID:redBorder,項目名稱:rb-bi,代碼行數:81,代碼來源:LocationLogicMse.java

示例9: rowKey

import storm.trident.tuple.TridentTuple; //導入方法依賴的package包/類
public byte[] rowKey(TridentTuple tuple) {
    Object objVal = tuple.getValueByField(this.rowKeyField);
    return toBytes(objVal);
}
 
開發者ID:mengzhiyi,項目名稱:storm-hbase-1.0.x,代碼行數:5,代碼來源:SimpleTridentHBaseMapper.java


注:本文中的storm.trident.tuple.TridentTuple.getValueByField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。