-
-
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.
* Experimenting with partition assignment * Fix partition assignment * Revert "wip: docs" This reverts commit f219cc1. * Updating docs * Rename variable * Rename variable * Update changelog
- Loading branch information
1 parent
98c49ff
commit 389b06d
Showing
15 changed files
with
82 additions
and
24 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
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
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
2 changes: 1 addition & 1 deletion
2
docs/consuming-messages/9-class-structure.md → .../consuming-messages/10-class-structure.md
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
2 changes: 1 addition & 1 deletion
2
...nsuming-messages/10-queueable-handlers.md → ...nsuming-messages/11-queueable-handlers.md
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
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,31 @@ | ||
--- | ||
title: Assigning consumers to a topic partition | ||
weight: 3 | ||
--- | ||
|
||
Kafka clients allows you to implement your own partition assignment strategies for consumers. | ||
|
||
If you have a topic with multiple consumers and want to assign a consumer to a specific partition topic, you can | ||
use the `assignPartitions` method, available on the `ConsumerBuilder` instance: | ||
|
||
|
||
```php | ||
$partition = 1; // The partition number you want to assign | ||
|
||
$consumer = \Junges\Kafka\Facades\Kafka::createConsumer() | ||
->assignPartitions([ | ||
new \RdKafka\TopicPartition('your-topic-name', $partition) | ||
]); | ||
``` | ||
|
||
The `assignPartitions` method accepts an array of `\RdKafka\TopicPartition` objects. You can assign multiple partitions to the same consumer | ||
by adding more entries to the `assignPartitions` parameter: | ||
|
||
```php | ||
$consumer = \Junges\Kafka\Facades\Kafka::createConsumer() | ||
->assignPartitions([ | ||
new \RdKafka\TopicPartition('your-topic-name', 1) | ||
new \RdKafka\TopicPartition('your-topic-name', 2) | ||
new \RdKafka\TopicPartition('your-topic-name', 3) | ||
]); | ||
``` |
2 changes: 1 addition & 1 deletion
2
docs/consuming-messages/3-consumer-groups.md → docs/consuming-messages/4-consumer-groups.md
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
2 changes: 1 addition & 1 deletion
2
.../consuming-messages/4-message-handlers.md → .../consuming-messages/5-message-handlers.md
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
2 changes: 1 addition & 1 deletion
2
...essages/5-configuring-consumer-options.md → ...essages/6-configuring-consumer-options.md
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
2 changes: 1 addition & 1 deletion
2
...suming-messages/6-custom-deserializers.md → ...suming-messages/7-custom-deserializers.md
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
2 changes: 1 addition & 1 deletion
2
...onsuming-messages/7-consuming-messages.md → ...onsuming-messages/8-consuming-messages.md
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
2 changes: 1 addition & 1 deletion
2
...ming-messages/8-handling-message-batch.md → ...ming-messages/9-handling-message-batch.md
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
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
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
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