use of org.openkilda.messaging.info.InfoData in project open-kilda by telstra.
the class SpeakerBolt method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(Tuple tuple) {
logger.debug("Ingoing tuple: {}", tuple);
String request = tuple.getString(0);
// String request = tuple.getStringByField("value");
try {
Message stats = Utils.MAPPER.readValue(request, Message.class);
if (!Destination.WFM_STATS.equals(stats.getDestination()) || !(stats instanceof InfoMessage)) {
return;
}
InfoMessage message = (InfoMessage) stats;
final InfoData data = message.getData();
if (data instanceof PortStatsData) {
logger.debug("Port stats message: {}", new Values(request));
outputCollector.emit(PORT_STATS_STREAM, tuple, new Values(message));
} else if (data instanceof MeterConfigStatsData) {
logger.debug("Meter config stats message: {}", new Values(request));
outputCollector.emit(METER_CFG_STATS_STREAM, tuple, new Values(message));
} else if (data instanceof FlowStatsData) {
logger.debug("Flow stats message: {}", new Values(request));
outputCollector.emit(FLOW_STATS_STREAM, tuple, new Values(message));
}
} catch (IOException exception) {
logger.error("Could not deserialize message={}", request, exception);
} finally {
outputCollector.ack(tuple);
logger.debug("Message ack: {}", request);
}
}
use of org.openkilda.messaging.info.InfoData in project open-kilda by telstra.
the class OpenTSDBFilterBoltTest method mockTuple.
private void mockTuple(long timestamp) throws Exception {
InfoData infoData = new Datapoint(METRIC, timestamp, Collections.emptyMap(), VALUE);
when(tuple.contains(eq("datapoint"))).thenReturn(true);
when(tuple.getValueByField(eq("datapoint"))).thenReturn(infoData);
}
Aggregations