Produce test messages to a Hermes topic using the Kafka client

  • Rversion finale: Australia
  • Mis à jour 12 mars 2026
  • 1 minute de lecture
  • Produce test messages to a Hermes topic by configuring a producer client.

    Avant de commencer

    Role required: admin

    Pourquoi et quand exécuter cette tâche

    The following steps describe how to configure a producer client and send test messages to the Hermes Kafka cluster. Refer to these steps when you're ready to produce messages to Hermes for business or production purposes.

    Procédure

    1. Navigate to the config directory where you extracted Kafka.
      • For example, on Unix:
        cd /home/user/Software/kafka/config
      • For example, on Windows:
        cd C:\Software\kafka\config
    2. Configure a producer.
      1. Open the producer.properties file.
      2. Configure the following SSL properties:
        security.protocol=SSL
        
        ssl.truststore.password=<truststore password>
        
        ssl.truststore.location=<path to truststore.p12>
        
        ssl.truststore.type=PKCS12
        
        ssl.keystore.password=<keystore password>
        
        ssl.keystore.location=<path to keystore.p12>
        
        ssl.keystore.type=PKCS12
        
        ssl.key.password=<keystore password>
        Replace the following placeholder variables:
        • <truststore password> with your truststore password
        • <path to truststore.p12> with the path to your truststore file
        • <keystore password> with your keystore password
        • <path to keystore.p12> with the path to your keystore file
      3. Save your changes in plain text.
    3. Produce a test topic.
      1. Navigate to the Kafka directory.
      2. Run the following command:
        Unix:
        ./bin/kafka-console-producer.sh --topic snc.<instance_name>.<namespace>.sn_<app_id>.<topic_name> --producer.config ./config/producer.properties --bootstrap-server <instance_name>.service-now.com:4000,<instance_name>.service-now.com:4001,<instance_name>.service-now.com:4002,<instance_name>.service-now.com:4003
        Windows:
        bin\windows\kafka-console-producer.bat --topic snc.<instance_name>.<namespace>.sn_<app_id>.<topic_name> --producer.config config\producer.properties --bootstrap-server <instance_name>.service-now.com:4000,<instance_name>.service-now.com:4001,<instance_name>.service-now.com:4002,<instance_name>.service-now.com:4003
        Replace the following placeholder variables:
        • <instance_name> with your instance name
        • <namespace> with the namespace of the domain your Kafka topic belongs to (optional)
        • <app_id> with the application ID
        • <topic_name> with a unique test topic name
        Remarque :
        Each part of the topic name is case-sensitive.
      3. Send test messages to the test topic.
        For example:
        test1
        test2
        test3

    Résultats

    Test messages are produced to the test topic in the Hermes Kafka cluster.

    Que faire ensuite

    Consume test messages from a Hermes topic using the Kafka client