@Test public void deSerializeEvent() { GenericEvent event = GenericEventBuilder.anEvent() .withEvent("Type") .withTimestamp(1L) .withSource("me") .withParameter("a", Value.of(1L)) .withParameter("b", Value.of("String")) .build(); GenericEvent event1; try (EventSerializer ser = new EventSerializer()) { try (EventDeserializer deSer = new EventDeserializer()) { byte[] bytes = ser.serialize("", event); event1 = deSer.deserialize("", bytes); } } Assert.assertEquals(event, event1); }
@Override public GenericEvent deserialize(String topic, byte[] data) { UntypedEvent event = null; try { event = objectMapper.readValue(data, UntypedEvent.class); } catch (IOException e) { logger.error("deserialization failed for object", e); return null; } return event.asEvent(); }
EventDeserializer implements Deserializer<GenericEvent> { @Override public GenericEvent deserialize(String topic, byte[] data) { UntypedEvent event = null; try { event = objectMapper.readValue(data, UntypedEvent.class); } catch (IOException e) { logger.error("deserialization failed for object", e); return null; } return event.asEvent(); } }
EventDeserializer implements Deserializer<GenericEvent> { @Override public GenericEvent deserialize(String topic, byte[] data) { UntypedEvent event = null; try { event = objectMapper.readValue(data, UntypedEvent.class); } catch (IOException e) { logger.error("deserialization failed for object", e); return null; } return event.asEvent(); }  }
EventDeserializer implements Deserializer<GenericEvent> { @Override public GenericEvent deserialize(String topic, byte[] data) { UntypedEvent event = null; try { event = objectMapper.readValue(data, UntypedEvent.class); } catch (IOException e) { logger.error("deserialization failed for object", e); return null; } return event.asEvent(); }  @Override void configure(Map<String, ?> map, boolean b); @Override GenericEvent deserialize(String topic, byte[] data); @Override void close(); }
EventDeserializer implements Deserializer<GenericEvent> { @Override public GenericEvent deserialize(String topic, byte[] data) { UntypedEvent event = null; try { event = objectMapper.readValue(data, UntypedEvent.class); } catch (IOException e) { logger.error("deserialization failed for object", e); return null; } return event.asEvent(); }  @Override void configure(Map<String, ?> map, boolean b); @Override GenericEvent deserialize(String topic, byte[] data); @Override void close();  }