LaravelPackages.net
Acme Inc.
Toggle sidebar
sadegh2007/laravel_queue_kafka

Kafka Driver For Laravel

4
1
0.0.2
About sadegh2007/laravel_queue_kafka

sadegh2007/laravel_queue_kafka is a Laravel package for kafka driver for laravel. It currently has 1 GitHub stars and 4 downloads on Packagist (latest version 0.0.2). Install it with composer require sadegh2007/laravel_queue_kafka. Discover more Laravel packages by sadegh2007 or browse all Laravel packages to compare alternatives.

Last updated

Kafka Queue driver for Laravel

Installation

You can install this package via composer using this command:

composer require sadegh2007/laravel_queue_kafka

The package will automatically register itself.

Add connection to config/queue.php:

'connections' => [
    // ...

    'kafka' => [
        'driver' => 'kafka',
        'sleep_on_error' => env('KAFKA_SLEEP_ON_ERROR', 5),
        'topics' => env('KAFKA_TOPICS', 'default'),
        'debug' => env('KAFKA_DEBUG', false),
        'brokers' => env('KAFKA_BROKERS', 'localhost:9092'),
        'auto_commit' => 'false',
        'group_id' => 'myConsumerGroup',
        'consumer' => [
            'sasl.username' => env('KAFKA_USERNAME', null),
            'sasl.password' => env('KAFKA_PASSWORD', null),
            'auto.offset.reset' => 'smallest',
            'security.protocol' => env('KAFKA_SECURITY_PROTOCOL', 'SASL_SSL'),
            'sasl.mechanisms' => env('KAFKA_SASL_MECHANISMS', 'SCRAM-SHA-256'),
            'compression.type' => 'gzip',
        ],
        'producer' => [
            'sasl.username' => env('KAFKA_USERNAME', null),
            'sasl.password' => env('KAFKA_PASSWORD', null),
            'security.protocol' => env('KAFKA_SECURITY_PROTOCOL', 'SASL_SSL'),
            'sasl.mechanisms' => env('KAFKA_SASL_MECHANISMS', 'SCRAM-SHA-256'),
            'compression.type' => 'gzip',
            'log_level' => LOG_DEBUG,
            'debug' => 'all'
        ]
    ],

    // ...
],

Lumen Usage

For Lumen usage the service provider should be registered manually as follow in bootstrap/app.php:

$app->register(Sadeq\LaravelQueueKafka\KafkaServiceProvider::class);

Consuming Messages

There are one ways of consuming messages for now.

  1. kafka:consume command which is provided by this package.

you can specify topics with command option --topics=default

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.

Comments