Consuming messages
After configuring the consumer, call the build method to create it, and then the consume method to start consuming messages:
$consumer = \Junges\Kafka\Facades\Kafka::consumer(['topic']) ->withHandler(new Handler) ->build(); $consumer->consume();
The consume method runs until the consumer is stopped, either by a signal , by the handler , by one of the limits set with stopAfterMessages, stopAfterSeconds or stopWhenEmpty, or when a message fails and there is no dead letter queue.
Consumer classes are run with the kafka:consume artisan command instead, see consumer classes .
Support Laravel Kafka by sponsoring me!
Laravel Kafka is free and Open Source software, built to empower developers like you. Your support helps maintain and enhance the project. If you find it valuable, please consider sponsoring me on GitHub. Every contribution makes a difference and keeps the development going strong! Thank you!