rapide/laravel-queue-kafka
Composer 安装命令:
composer require rapide/laravel-queue-kafka
包简介
Kafka driver for Laravel Queue
README 文档
README
Installation
-
Install librdkafka c library
$ cd /tmp $ mkdir librdkafka $ cd librdkafka $ git clone https://github.com/edenhill/librdkafka.git . $ ./configure $ make $ make install
-
Install the php-rdkafka PECL extension
$ pecl install rdkafka
-
a. Add the following to your php.ini file to enable the php-rdkafka extension
extension=rdkafka.sob. Check if rdkafka is installed
Note: If you want to run this on php-fpm restart your php-fpm first.php -i | grep rdkafkaYour 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 rapide/laravel-queue-kafka -
Add LaravelQueueKafkaServiceProvider to
providersarray inconfig/app.php:Rapide\LaravelQueueKafka\LaravelQueueKafkaServiceProvider::class,If you are using Lumen, put this in
bootstrap/app.php$app->register(Rapide\LaravelQueueKafka\LumenQueueKafkaServiceProvider::class); -
Add these properties to
.envwith proper values:QUEUE_DRIVER=kafka -
If you want to run a worker for a specific consumer group
export KAFKA_CONSUMER_GROUP_ID="group2" && php artisan queue:work --sleep=3 --tries=3Explaination 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:
vendor/bin/phpunit
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: [5.4, 5.5, 5.6, 5.7]
New version is underway
A version for Laravel 6,7,8 is underway. Also supporting the new RdKafka library
rapide/laravel-queue-kafka 适用场景与选型建议
rapide/laravel-queue-kafka 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.08k 次下载、GitHub Stars 达 169, 最近一次更新时间为 2017 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rapide/laravel-queue-kafka 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rapide/laravel-queue-kafka 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 172
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-04