X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=nbinotifications%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fnbinotifications%2Fserialization%2FNotificationServiceSerializer.java;h=8090ccd268f8538027a56aec5999465d5520f321;hb=refs%2Fchanges%2F38%2F97438%2F40;hp=eb998746f9a1f25349f49d097921c008579ffa2a;hpb=28f2a7aea63e35dd31dd883aa796d11838959324;p=transportpce.git diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java index eb998746f..8090ccd26 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java @@ -12,15 +12,15 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import org.apache.kafka.common.serialization.Serializer; import org.opendaylight.transportpce.common.converter.JsonStringConverter; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev201130.NotificationService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NotificationServiceSerializer implements Serializer { +public class NotificationServiceSerializer implements Serializer { private static final Logger LOG = LoggerFactory.getLogger(NotificationServiceSerializer.class); - private JsonStringConverter converter; + private JsonStringConverter converter; @SuppressWarnings("unchecked") @Override @@ -28,25 +28,26 @@ public class NotificationServiceSerializer implements Serializer) { - converter = (JsonStringConverter) configs.get(ConfigConstants.CONVERTER); + converter = (JsonStringConverter) configs.get(ConfigConstants.CONVERTER); } } @Override - public byte[] serialize(String topic, NotificationService data) { + public byte[] serialize(String topic, NotificationProcessService data) { if (converter == null) { - throw new IllegalArgumentException( - "Converter should be" + "configured through configure method of serializer"); + throw new IllegalArgumentException("Converter should be configured through configure method of serializer"); } if (data == null) { return new byte[0]; } try { - InstanceIdentifier iid = InstanceIdentifier.builder(NotificationService.class).build(); + InstanceIdentifier iid = InstanceIdentifier + .builder(NotificationProcessService.class).build(); String serialized = converter.createJsonStringFromDataObject(iid, data, JSONCodecFactorySupplier.RFC7951); LOG.info("Serialized event {}", serialized); return serialized.getBytes(StandardCharsets.UTF_8); } catch (IOException e) { + LOG.error("exception raised during serialization", e); return new byte[0]; } }