Complete the code to implement the serialize method in a custom Kafka Serializer.
public byte[] serialize(String topic, [1] data) { if (data == null) { return null; } return data.getBytes(StandardCharsets.UTF_8); }
Complete the code to implement the deserialize method in a custom Kafka Deserializer.
public String deserialize(String topic, [1] data) { if (data == null) { return null; } return new String(data, StandardCharsets.UTF_8); }
Fix the error in the custom Serializer class declaration.
public class CustomSerializer implements Serializer<[1]> { // implementation }
Fill both blanks to complete the custom Deserializer class declaration and method signature.
public class CustomDeserializer implements Deserializer<[1]> { @Override public [2] deserialize(String topic, byte[] data) { if (data == null) return null; return new String(data, StandardCharsets.UTF_8); } }
Fill all three blanks to complete the custom SerDes class with serializer, deserializer, and configure method.
public class CustomSerDes implements Serializer<[1]>, Deserializer<[2]> { @Override public byte[] serialize(String topic, [3] data) { if (data == null) return null; return data.getBytes(StandardCharsets.UTF_8); } @Override public [2] deserialize(String topic, byte[] data) { if (data == null) return null; return new String(data, StandardCharsets.UTF_8); } @Override public void configure(Map<String, ?> configs, boolean isKey) { // configuration code if needed } @Override public void close() { // cleanup code if needed } }
