zhizhong / kafka
help to use kafka in laravel
Installs: 6 377
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
This package is not auto-updated.
Last update: 2024-05-24 07:22:40 UTC
README
composer require zhizhong/kafka:dev-master
Config
set kafka brokers routes in your env ,it can be a list by string
KAFKA_BROKERS=127.0.0.1:2086,127.0.0.2:2086
Usage
Producer
the easy way to produce is use help function kafka_dispatch
kafka_dispatch($topic, $msg)
Note: $msg must be an array
Consumer
$consumer = new Consumer($topic); while (true) { $msg = $consumer->consume(); print_r($msg); }