private void printJson(Object data) {
        try {
            System.out.println(mapper.writeValueAsString(data));
        } catch (JsonProcessingException e) {
            System.out.println("Bad data can't be written as json: " + e.getMessage());
        }
    }
Close the producer to flush any remaining messages.
tools/src/main/java/org/apache/kafka/tools/VerifiableProducer.java