code: public void pushMessages(List<byte[]> messages) {
      for (byte[] message: messages) {
        producer.send(new ProducerRecord<>(topic, message), (recordMetadata, e) -> {
          if (e != null) {
            log.error("Failed to send message to topic {} due to exception: ", topic, e);
          }
        });
      }
    }
docs: Push all byte array messages to the Kafka topic.
  @param messages List of byte array messages to push to Kakfa.