This is the documentation for
v1.13 but the latest version is
v2.0
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show mateusjunges/laravel-kafka
At this moment, there is no way of setting global configuration for producers/consumers, but you can use laravel macro
functionality
to achieve that. Here's an example:
// In a service provider:
\Junges\Kafka\Facades\Kafka::macro('myProducer', function () {
return $this->publishOn('my-awesome-topic')
->withConfigOption('key', 'value');
});
Now, you can call \Junges\Kafka\Facades\Kafka::myProducer()
, which will always apply the configs you defined in your service provider.