NicolasMugnier / poc-php-kafka

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

POC php Kafka

Installation

Main library

librdkafka

sudo apt install librdkafka-dev

php extension

arnaud-lb/php-rdkafka

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

Docs

About


Languages

Language:PHP 100.0%