aplr/kafkaesk
Composer 安装命令:
composer require aplr/kafkaesk
包简介
Laravel Kafka queue driver
README 文档
README
Kafkaesk adds support for Apache Kafka to Laravel Queues. It builds upon the rdkafka php extension, which you will have to install seperately. Also, you have to install the C/C++ client library librdkafka upfront. Afterwards, you can freely push jobs to your favorite Kafka queue!
Kafkaesk supports PHP 7.2-7.4 and requires Laravel 6-7. If you still need to support Laravel 5 use rapideinternet/laravel-queue-kafka, which Kafkaesk is a fork of.
Installation
To install the latest version of aplr/kafkaesk just require it using composer.
composer require aplr/kafkaesk
This package is using Laravel's package auto-discovery, so it doesn't require you to manually add the ServiceProvider. If you've opted out of this feature, add the ServiceProvider to the providers array in config/app.php:
Aplr\Kafkaesk\ServiceProvider::class,
Requirements
Make sure you have installed the C/C++ client library librdkafka. If you're running macOS, you can simply use Homebrew to install it.
brew install librdkafka
Additionally you have to install the php extension rdkafka. You can do this either manually or simply by using pecl.
pecl install rdkafka
If both installs succeed, you're all set!
Configuration
The default configuration is set in config/kafkaesk.php. Merge the contents of this file with the connections array in your local config/queue.php. You can do this using the command below.
php artisan vendor:publish --provider="Aplr\Kafkaesk\ServiceProvider"
Environment variables
When using the default configuration, you can also use the environment variables described below to configure the queue driver.
| Name | Default | Description |
|---|---|---|
KAFKA_QUEUE |
default |
The name of the default queue. |
KAFKA_CONSUMER_GROUP_ID |
laravel |
The group in which the consumer resides. |
KAFKA_BROKERS |
localhost |
Kafka broker address. |
KAFKA_ERROR_SLEEP |
5 |
Seconds to sleep on communication error. |
KAFKA_DEADLOCK_SLEEP |
2 |
Seconds to sleep on deadlocks |
KAFKA_SASL_USERNAME |
SASL username | |
KAFKA_SASL_PASSWORD |
SASL password |
Usage
Since Kafkaesk is just a driver for Laravel Queues, just read through their extensive documentation.
Limitations
Currently, deferring jobs on the queue using the later function of Laravel Queues is not yet supported by this library. Feel free to add support by creating a PR!
Acknowledgements
This library is a fork of the outdated rapideinternet/laravel-queue-kafka, adding support for Laravel 6-7, fixing tests and fancying everything up a bit.
Licence
Kafkaesk is licenced under The MIT Licence (MIT).
aplr/kafkaesk 适用场景与选型建议
aplr/kafkaesk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.28k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2020 年 04 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aplr/kafkaesk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aplr/kafkaesk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-24