Fixed bug with REST API data representation for telemetry plugin
This commit is contained in:
		
							parent
							
								
									3aeafecfb1
								
							
						
					
					
						commit
						83f179e8c7
					
				@ -291,7 +291,6 @@ public class SubscriptionManager {
 | 
			
		||||
                    } else {
 | 
			
		||||
                        log.trace("[{}] Remote subscription is now handled on new server address: [{}]", s.getWsSessionId(), newAddress);
 | 
			
		||||
                        subscriptionIterator.remove();
 | 
			
		||||
 | 
			
		||||
                        //TODO: onUpdate state of subscription by WsSessionId and other maps.
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -139,7 +139,12 @@ public class TelemetryRestMsgHandler extends DefaultRestMsgHandler {
 | 
			
		||||
            public void onSuccess(PluginContext ctx, List<TsKvEntry> data) {
 | 
			
		||||
                Map<String, List<TsData>> result = new LinkedHashMap<>();
 | 
			
		||||
                for (TsKvEntry entry : data) {
 | 
			
		||||
                    result.put(entry.getKey(), data.stream().map(v -> new TsData(v.getTs(), v.getValueAsString())).collect(Collectors.toList()));
 | 
			
		||||
                    List<TsData> vList = result.get(entry.getKey());
 | 
			
		||||
                    if (vList == null) {
 | 
			
		||||
                        vList = new ArrayList<>();
 | 
			
		||||
                        result.put(entry.getKey(), vList);
 | 
			
		||||
                    }
 | 
			
		||||
                    vList.add(new TsData(entry.getTs(), entry.getValueAsString()));
 | 
			
		||||
                }
 | 
			
		||||
                msg.getResponseHolder().setResult(new ResponseEntity<>(result, HttpStatus.OK));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user