michaeldouglas/debeziumstream

A client library to work with debezium and apache kafka for Database stream.

0.06 2018-09-27 04:32 UTC

This package is not auto-updated.

Last update: 2025-06-27 13:22:57 UTC


README

Requirements

  1. Guzzle HTTP
  2. Laravel 5.2+

Install Library

in folder of project run:

$ composer require michaeldouglas/debeziumstream

Configure Apache KAFKA and DEBEZIUM

Insert into .env file the folowers config lke example:

KAFKA_HOST=18.231.179.169
KAFKA_PORT=9092
KAFKA_CONNECT_HOST=18.231.179.169:8083"
KAFKA_CONSUMER_BINARY="kafka-console-consumer"
KAFKA_CONSUMER_BINARY_PATH=/usr/local/etc/confluent/bin
 
DEBEZIUM_DB_CONNECTOR=mysql
DEBEZIUM_DB_CONNECTOR_NAME=otrs3-connector
DEBEZIUM_DB_HOST=127.0.0.1
DEBEZIUM_DB_DATABASE=otrs5
DEBEZIUM_DB_SERVER_ID=1
DEBEZIUM_DB_SERVER_NAME=localdb
DEBEZIUM_DB_USER=root
DEBEZIUM_DB_PASSWORD=

Configure Service Provider

In file config\app.php inside providers put the code:

 MichaelDouglas\DebeziumStream\Providers\DebeziumKafkaServiceProvider::class

Publish config files

$ php artisan vendor:publish

Configure class to receive KAFKA EVENTS

In file config\kafka.php

 /*
    |--------------------------------------------------------------------------
    | Handle Class
    |--------------------------------------------------------------------------
    | The class who will receive Kafka Topic Messages
    */
    'handler_class' => 'your class here',
 
    /*
    |--------------------------------------------------------------------------
    | Handle Methods
    |--------------------------------------------------------------------------
    | The class methods who will receiver Kafka Events
    */
    'event_methods' => [
       'create' => 'your method here',
       'update' => 'your method here',
       'delete' => 'your method here'
    ]

The params look like this example:

class TestService
{


    public function create($after, $topic)
    {

    }


    public function update($before, $after, $topic)
    {

    }



    public function delete($before, $topic)
    {

    }


}

Init Kafka Consumer Work

$ php artisan kafka:listen --topic=topic_name

laravel-debeziumstream