Use the CLI Kafka Tools included on your Kafka binary distribution to start the console consumer. This will print the data coming from the topic on your console. Start it using the following command:
bin/kafka-console-consumer.sh --bootstrap-server="host:port" --topic mytopic --group groupId --consumer-property security.protocol=SASL_SSL
--consumer-property sasl.mechanism=SCRAM-SHA-256 --consumer-property auto.offset.reset=earliest #--consumer-property auto.offset.reset=latest
CODE