kafka maintained by septech-laravel
Description
Rdkafka connector for Laravel
Author
Last update
2020/11/18 05:39
(dev-master)
License
Downloads
102
Installation
composer require septech-laravel/kafka
Usage
Environment variables
# The kafka brokers, seperate by command
KAFKA_BROKERS=10.0.0.2,127.0.0.1
KAFKA_SSL_CA_LOCATION=./ca.crt
# For SSL client
SECURITY_PROTOCOL=[ssl | plaintext]
KAFKA_SSL_CERTIFICATE_LOCATION=./user.crt
KAFKA_SSL_KEY_LOCATION=./user.key
KAFKA_SSL_KEY_PASSWORD=SOME_PASSWORD
Via injection
<?php
use Septech\Kafka\Kafka;
class MessageController
{
public function send(Kafka $kafka)
{
$message = json_encode(['message' => 'Hi, from kafka with love <3']);
$kafka->produce("some.topic", $message);
}
}
Via Facade
<?php
use Septech\Kafka\Facades\Kafka;
$message = json_encode(['message' => 'Hi, from kafka with love <3']);
Kafka::produce("some.topic", $message);
Look like package is missing something?
Well, nothing this absolutely perfect at first time. I just create this package for my purpose. If you want more features for this package. It needs you. Feel free send me a PR.