Produce and consume messages using authentication
This process describes how to produce and consume messages using authentication.
-
Run the following command to create a topic. The file named
client.properties
is the one you created in the previous procedure.<path-to-your-kafka-installation>
/bin/kafka-topics.sh --create --bootstrap-serverBootstrapBroker-String
--replication-factor 3 --partitions 1 --topic ExampleTopic --command-config client.properties -
Run the following command to start a console producer. The file named
client.properties
is the one you created in the previous procedure.<path-to-your-kafka-installation>
/bin/kafka-console-producer.sh --bootstrap-serverBootstrapBroker-String
--topic ExampleTopic --producer.config client.properties -
In a new command window on your client machine, run the following command to start a console consumer.
<path-to-your-kafka-installation>
/bin/kafka-console-consumer.sh --bootstrap-serverBootstrapBroker-String
--topic ExampleTopic --consumer.config client.properties -
Type messages in the producer window and watch them appear in the consumer window.