Running Kafka on Docker with PHP client for producing and consuming messages.
Testing the kafka server via the CLI.
Steps taken from the Apache Kafka Quickstart.
/usr/bin/kafka-topics --create --topic quickstart-events --bootstrap-server localhost:9092
Show topic details
/usr/bin/kafka-topics --describe --topic quickstart-events --bootstrap-server localhost:9092
/usr/bin/kafka-console-producer --topic quickstart-events --bootstrap-server localhost:9092
>my first event
>my second event
crtl+c to stop
/usr/bin/kafka-console-consumer --topic quickstart-events --from-beginning --bootstrap-server localhost:9092
crtl+c to stop
Example using the RdKafka extension that provides a Kafka client for PHP.