Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larvatecn/laravel-queue-kafka
Kafka queue for Laravel. 适用于 Laravel 的 Kafka 队列。
https://github.com/larvatecn/laravel-queue-kafka
Last synced: 1 day ago
JSON representation
Kafka queue for Laravel. 适用于 Laravel 的 Kafka 队列。
- Host: GitHub
- URL: https://github.com/larvatecn/laravel-queue-kafka
- Owner: larvatecn
- License: mit
- Created: 2021-03-06T10:09:56.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-06T10:14:46.000Z (almost 4 years ago)
- Last Synced: 2024-12-03T11:15:14.699Z (19 days ago)
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# laravel-queue-kafka
This is a queue adapter for the Kafka.
修改自 https://github.com/rapideinternet/laravel-queue-kafka## Installation
```bash
composer require larva/laravel-queue-kafka
```## for Laravel
This service provider must be registered.
```php
// config/app.php'providers' => [
'...',
Larva\Queue\Kafka\KafkaServiceProvider::class,
];
```edit the config file: config/queue.php
add config
```php
'kafka' => [
/*
* Driver name
*/
'driver' => 'kafka',
/*
* The name of default queue.
*/
'queue' => env('KAFKA_QUEUE', 'default'),
/*
* The group of where the consumer in resides.
*/
'consumer_group_id' => env('KAFKA_CONSUMER_GROUP_ID', 'laravel_queue'),
/*
* Address of the Kafka broker
*/
'brokers' => env('KAFKA_BROKERS', 'localhost'),
/*
* Determine the number of seconds to sleep if there's an error communicating with kafka
* If set to false, it'll throw an exception rather than doing the sleep for X seconds.
*/
'sleep_on_error' => env('KAFKA_ERROR_SLEEP', 5),
/*
* Sleep when a deadlock is detected
*/
'sleep_on_deadlock' => env('KAFKA_DEADLOCK_SLEEP', 2),
/*
* 全局默认配置
*/
'defaultConf' => [
'enable.auto.commit' => 'false',
'offset.store.method' => 'broker',
//'security.protocol' => 'SASL_SSL',
//'sasl.mechanisms' => 'PLAIN',
//'sasl.username' => '',
//'sasl.password' => '',
//'ssl.ca.location' => '/ca-cert.pem',
]
],
```change default to mns
```php
'default' => 'kafka'
```## Use
see [Laravel wiki](https://laravel.com/docs/5.7/queues)