use of org.onosproject.codec.JsonCodec in project onos by opennetworkinglab.
the class KafkaTelemetryManager method encodeStrings.
private ObjectNode encodeStrings(Set<LinkInfo> infos, CodecContext context, String codecName) {
ObjectNode root = context.mapper().createObjectNode();
ArrayNode array = context.mapper().createArrayNode();
try {
Class codecClazz = Class.forName(codecName);
JsonCodec codec = codecService.getCodec(codecClazz);
infos.forEach(l -> array.add(codec.encode(l, context)));
} catch (ClassNotFoundException e) {
log.warn("Failed to send telemetry record due to {}", e);
}
root.set(LINK_INFOS, array);
return root;
}
Aggregations