Skip to content

nasservb/php-kafka-docker-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

how to use kafka in php when using docker-compose

by using this project, you could use kafka in php. #how to use :

pull images and up project:

docker-compose up -d

add kafka extention on php:

docker-compose exec php bash
apk add librdkafka
pecl install rdkafka
docker-php-ext-enable  rdkafka
exit

create topic

docker-compose exec kafka bash
#create topic 
kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic nasser
exit 

open new terminal window for consumer:

docker-compose exec php bash 
php kafka_example/consumer-high-level.php

keep open this teminal and open new terminal for producer:

docker-compose exec php bash 
php kafka_example/producer-simple.php

About

use kafka in docker compose

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published