POC php Kafka
Installation
Main library
sudo apt install librdkafka-dev
php extension
sudo pecl install rdkafka
Enable the extension by adding extension=rdkafka.so
in php.ini
file.
Dependencies
composer install
Run
docker-compose up -d
Run batch message producer, it will generate an array of 100 items and push it into batch-message
topic. The topic will be created if it does not exists.
php ./src/BatchMessageProducer.php
Run batch message consumer, it will split the batch message and push singles messages on single-message
topic. The topic will be created if it does not exists.
php ./src/BatchMessageConsumer.php
Run single message consumer, it will just display message content in the console.
php ./src/SingleMessageConsumer.php