private byte[] stacktrace(Throwable error) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            PrintStream stream = new PrintStream(bos, true, StandardCharsets.UTF_8.name());
            error.printStackTrace(stream);
            bos.close();
            return bos.toByteArray();
        } catch (IOException e) {
            log.error("Could not serialize stacktrace.", e);
        }
        return null;
    }
Write the raw records into a Kafka topic and return the producer future.

@param context processing context containing the raw record at {@link ProcessingContext#original()}.
@return the future associated with the writing of this record; never null
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/errors/DeadLetterQueueReporter.java