Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 1.92 KB

File metadata and controls

26 lines (15 loc) · 1.92 KB

Run the demo

  1. Refer to the CPP demo to install the Kafka library first.
  2. This Demo is based on the open source client php-rdkafka. Install the corresponding module based on the installation guide first. You may need to configure php.ini after you install the module. To confirm whether the installation is successful, call php -m|grep kafka.
  3. Configure setting.php based on the following instructions.
  4. Modify other configurations in the code. Example: $conf->set('xxx', 'xxx');. For information about the description of the configurations, see Configuration properties.
  5. Run the php kafka-producer.php file to send messages.
  6. Run the php kafka-consumer.php file to consume messages.

Configuration description

Configuration file in demo Parameter Description
setting.php topic_name The name of the topic that you created in the Message Queue for Apache Kafka console. For more information, see Create resources.
setting.php consumer_id The ID of the consumer group that you created in the Message Queue for Apache Kafka console. For more information, see Create resources.
setting.php bootstrap_servers The endpoint. For more information, see View endpoints.
setting.php sasl_plain_username The username. You can obtain the username on the Instance Details page in the Message Queue for Apache Kafka console.
setting.php sasl_plain_password The password. You can obtain the password on the Instance Details page in the Message Queue for Apache Kafka console.