larva / laravel-queue-kafka
This is a Laravel queue adapter for the Kafka.
1.0.0
2021-03-06 10:13 UTC
Requires
- ext-rdkafka: *
- illuminate/database: ^6.0 || ^7.0 || ^8.0
- illuminate/queue: ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-09-06 18:43:19 UTC
README
This is a queue adapter for the Kafka. 修改自 https://github.com/rapideinternet/laravel-queue-kafka
Installation
composer require larva/laravel-queue-kafka
for Laravel
This service provider must be registered.
// config/app.php 'providers' => [ '...', Larva\Queue\Kafka\KafkaServiceProvider::class, ];
edit the config file: config/queue.php
add config
'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
'default' => 'kafka'
Use
see Laravel wiki