Download the PHP package ruanvsoares/laravel-queue-kafka without Composer
On this page you can find all versions of the php package ruanvsoares/laravel-queue-kafka. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ruanvsoares/laravel-queue-kafka
More information about ruanvsoares/laravel-queue-kafka
Files in ruanvsoares/laravel-queue-kafka
Package laravel-queue-kafka
Short Description Kafka driver for Laravel Queue
License MIT
Informations about the package laravel-queue-kafka
Kafka Queue driver for Laravel
Installation
-
Install librdkafka c library
-
Install the php-rdkafka PECL extension
-
a. Add the following to your php.ini file to enable the php-rdkafka extension
extension=rdkafka.so
b. Check if rdkafka is installed
Note: If you want to run this on php-fpm restart your php-fpm first.php -i | grep rdkafka
Your output should look something like this
rdkafka rdkafka support => enabled librdkafka version (runtime) => 1.0.0-RC2 librdkafka version (build) => 0.11.4.0
-
Install this package via composer using:
composer require ruanvsoares/laravel-queue-kafka
-
Add LaravelQueueKafkaServiceProvider to
providers
array inconfig/app.php
or inbootstrap/providers.php
:Rapide\LaravelQueueKafka\LaravelQueueKafkaServiceProvider::class,
-
Add these properties to
.env
with proper values:QUEUE_DRIVER=kafka
-
If you want to run a worker for a specific consumer group add to
.env
KAFKA_CONSUMER_GROUP_ID="group2"
Explaination of consumergroups can be found in this article http://blog.cloudera.com/blog/2018/05/scalability-of-kafka-messaging-using-consumer-groups/
Usage
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues
Testing
Run the tests with:
Acknowledgement
This library is inspired by laravel-queue-rabbitmq by vyuldashev. And the Kafka implementations by Superbalist be sure to check those out.
Contribution
You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you create pull request or issue.
Supported versions of Laravel
Tested on: [11.*]
Fixes by Ruan Soares
- Adjust to work with Laravel 11
- Ajust to work with subscribe and commit at consumer, this make the consumer to work with multiple topics and partitions
- Add auto create of default topic
- Fully tested with Laravel 11
All versions of laravel-queue-kafka with dependencies
illuminate/database Version 11.*
illuminate/support Version 11.*
illuminate/queue Version 11.*
ext-rdkafka Version *