The samples in this article demonstrate how use the command-line clients that are included in Apache Kafka to connect to your Aiven for Apache Kafka service and pass a few messages.

Requirements:

To test your Aiven for Apache Kafka service:

  1. Define the following properties in the producer and consumer configuration files:

    security.protocol=SSL
    ssl.protocol=TLS
    ssl.key.password=secret
    ssl.keystore.location=/path/to/client.keystore.p12
    ssl.keystore.password=secret
    ssl.keystore.type=PKCS12
    ssl.truststore.location=/path/to/client.truststore.jks
    ssl.truststore.password=secret
    ssl.truststore.type=JKS

  2. Run the following command to call the producer.
    Enter one message per line and press CTRL-D to exit.

    kafka-console-producer.sh --broker-list getting-started-with-kafka.htn-aiven-demo.aivencloud.com:17705 --topic target-topic --producer.config producer.properties

    The corresponding command for the Kafka Avro console producer:

    kafka-avro-console-producer --broker-list kafka.htn-aiven-demo.aivencloud.com:17705 --producer.config producer.properties --topic target-topic --property value.schema='{"type":"record","name":"Test","fields":[{"name":"itemId","type":"string"},{"name":"description","type":"string"}]}' --property schema.registry.url=https://kafka.htn-aiven-demo.aivencloud.com:port --property basic.auth.credentials.source=USER_INFO --property basic.auth.user.info=avnadmin:schema-reg-password

  3. Run the following command to call the consumer:

    kafka-console-consumer.sh --bootstrap-server getting-started-with-kafka.htn-aiven-demo.aivencloud.com:17705 --topic target-topic --consumer.config consumer.properties --from-beginning

Did this answer your question?