-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs on setting global settings
- Loading branch information
1 parent
ca8abf2
commit f87bbd3
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
title: Setting global configurations | ||
weight: 8 | ||
--- | ||
|
||
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: | ||
|
||
|
||
```php | ||
// 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. |