arquivei/laravel-kafka-queue-connector

This package is abandoned and no longer maintained. No replacement package was suggested.

Kafka queue driver for Laravel

Maintainers

👁 arquivei

Package info

github.com/arquivei/laravel-kafka-queue-connector

pkg:composer/arquivei/laravel-kafka-queue-connector

Statistics

Installs: 1 066

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

1.2.0 2019-03-14 21:48 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

Apache-2.0 936633205b401ba09b98b941901709f868c18470

queuelaravelconnectorkafka

This package is auto-updated.

Last update: 2020-04-15 01:10:18 UTC


README

Kafka Queue driver for Laravel

Install

  1. Install librdkafka c library

    $ cd /tmp
    $ mkdir librdkafka
    $ cd librdkafka
    $ git clone https://github.com/edenhill/librdkafka.git .
    $ ./configure
    $ make
    $ make install
  2. Install the php-rdkafka PECL extension

    $ pecl install rdkafka
  3. Add the following to your php.ini file to enable the php-rdkafka extension extension=rdkafka.so

  4. Install this package via composer using:

    composer require arquivei/laravel-kafka-queue-connector

  5. Add queue config in section connections in your config/queue.php

 'kafka' => [
 'driver' => 'kafka',
 'queue' => env('KAFKA_QUEUE', 'default'),
 'brokers' => env('KAFKA_BROKERS', 'localhost'),
 'sleep_on_error' => env('KAFKA_ERROR_SLEEP', 5),
 'security.protocol' => env('SECURITY_PROTOCOL', 'PLAINTEXT'),
 'group.id' => env('GROUP_ID', 'php-kafka'),
 'sasl' => [
 'mechanisms' => env('SASL_MECHANISMS'),
 'username' => env('SASL_USERNAME'),
 'password' => env('SASL_PASSWORD'),
 ],
 'consumers' => [
 'default' => YourDefaultConsumerJob::class | false,
 'customs' => [
 [
 'validations' => [
 [
 'key' => [],
 'value' => '',
 ],
 [
 'key' => [],
 'value' => '',
 ],
 ],
 'job' => YourConsumerJob::class,
 ],
 ],
 ],
 ],

Important

  • if you want to consume events with custom structures, add consumers with the necessary rules

Run Tests

$ vendor/bin/phpunit tests

TODO

  • Add validation for illuminate pattern in src/Queue/Jobs/KafkaJob@getRawBody