Modulo_1-TratamientoDato/Kafka/Ejercicios/edem2021/Lab4/kafka-ksql-example/src/main/java/com/gft/dlp/kafka/OrderJsonSerializer.java
<reponame>mimove/EDEM2022<filename>Modulo_1-TratamientoDato/Kafka/Ejercicios/edem2021/Lab4/kafka-ksql-example/src/main/java/com/gft/dlp/kafka/OrderJsonSerializer.java<gh_stars>0package com.gft.dlp.kafka;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.kafka.common.serialization.Serializer;

public class OrderJsonSerializer implements Serializer {

    @Override
    public byte[] serialize(String s, Object o) {
        byte[] retVal = null;
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            retVal = objectMapper.writeValueAsString(o).getBytes();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return retVal;
    }

}

