🎸 Just some fun with Kafka, PHP and Swoole
🎸 Just some fun with Kafka, PHP and Swoole.
Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.
Swoole is a Coroutine based Async PHP Programming Framework to Build high-performance, scalable, concurrent TCP, UDP, Unix Socket, HTTP, WebSocket services with PHP and fluent Coroutine API.
<project root>/kafka
test -f kafka/bin/kafka-server-start.sh && echo OK
(should print OK
).kafka/bin/zookeeper-server-start.sh kafka/config/zookeeper.properties
kafka/bin/kafka-server-start.sh kafka/config/server.properties
kafka/bin/kafka-topics.sh --create --topic my-topic --bootstrap-server localhost:9092
Created topic my-topic.
should be the response pecl install swoole
Mainly https://github.com/easy-swoole/kafka
composer install
php consumer.php
kafka/bin/kafka-console-producer.sh --topic my-topic --bootstrap-server localhost:9092
Then just type some messages to the stdin. Press Ctrl+C
to stop.
Just checkout producer.php
.
⚠ Actually, I’m not sure if this is rocking. If you have a proper way to benchmark a consumer, please issue me.