Skip to content

Commit a914975

Browse files
committed
Fixed README readability
1 parent 99c56ef commit a914975

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

README.md

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,13 @@ configs.setProperty(ProducerConfig.PARTITIONER_CLASS_CONFIG,
4444
KafkaProducer<K, V> producer = new KafkaProducer<>(configs);
4545
```
4646
47-
To work properly you need to specify in the configuration which topic will have its partitions grouped into buckets.
48-
This is important because in Kafka topics are specified in a message level and not in a producer level.
49-
This means that the same producer can be used to write messages into different topics, so the partitioner needs to know which topic will have their partitions grouped into buckets.
50-
47+
To work properly, you need to specify in the configuration which topic will have its partitions grouped into buckets. This is important because, in Kafka, topics are specified at a message level and not at a producer level. This means that the same producer can write messages on different topics, so the partitioner needs to know which topic will have their partitions grouped into buckets.
5148
5249
```bash
5350
configs.setProperty(BucketPriorityConfig.TOPIC_CONFIG, "orders");
5451
```
5552
56-
Finally you have to specify in the configuration which buckets will be configured and what is the partition allocation for each one of them.
57-
The partition allocation is specified in terms of percentage.
58-
Note that the usage of the symbol `%` is optional.
59-
53+
Finally, specify in the configuration which buckets will be configured and what is the partition allocation for each one of them. The partition allocation is specified in terms of percentage. Note that the usage of the symbol `%` is optional.
6054
6155
```bash
6256
configs.setProperty(BucketPriorityConfig.BUCKETS_CONFIG, "Platinum, Gold");
@@ -68,10 +62,7 @@ In case of the allocation result in some partitions being left behind because th
6862
6963
### Messages and buckets
7064
71-
In order to specify which bucket should be used your producer need to provide this information on the message key.
72-
The partitioner will inspect each key in the attempt to understand in which bucket the message should be written.
73-
For this reason the key must be an instance of a [java.lang.String](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html) and it need to contain the bucket name either as one literal string or as the first part of a string separated by an delimiter.
74-
For example, to specify that the bucket is `Platinum` then following examples are valid:
65+
In order to specify which bucket should be used, your producer need to provide this information on the message key. The partitioner will inspect each key in the attempt to understand in which bucket the message should be written. For this reason, the key must be an instance of a [java.lang.String](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html) and it needs to contain the bucket name either as one literal string or as the first part of a string separated by a delimiter. For example, to specify that the bucket is `Platinum` then following examples are valid:
7566
7667
* Key = `"Platinum"`
7768
* Key = `"Platinum-001"`
@@ -105,19 +96,14 @@ configs.setProperty(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
10596
KafkaConsumer<K, V> consumer = new KafkaConsumer<>(configs);
10697
```
10798
108-
To work properly you need to specify in the configuration which topic will have its partitions grouped into buckets.
109-
This is important because in Kafka consumers can subscribe to multiple topics.
110-
This means that the same consumer can be used to read messages from different topics, so the assignor needs to know which topic will have their partitions grouped into buckets.
111-
99+
To work properly, you need to specify in the configuration which topic will have its partitions grouped into buckets. This is important because, in Kafka, consumers can subscribe to multiple topics. This means that the same consumer can read messages from different topics, so the assignor needs to know which topic will have their partitions grouped into buckets.
112100
113101
```bash
114102
configs.setProperty(BucketPriorityConfig.TOPIC_CONFIG, "orders");
115103
```
116104
117105
You also have to specify in the configuration which buckets will be configured and what is the partition allocation for each one of them.
118-
The partition allocation is specified in terms of percentage.
119-
Note that the usage of the symbol `%` is optional.
120-
Ideally the partition allocation configuration needs to be the same used in the producer.
106+
The partition allocation is specified in terms of percentage. Note that the usage of the symbol `%` is optional. Ideally, the partition allocation configuration needs to be the same used in the producer.
121107
122108
123109
```bash
@@ -136,9 +122,7 @@ configs.setProperty(BucketPriorityConfig.BUCKET_CONFIG, "Platinum");
136122
137123
### What about the other topics?
138124
139-
As you may know in Kafka a consumer can subscribe to multiple topics, allowing the same consumer to read messages from partitions belonging to different topics.
140-
Because of this the assignor ensures that only the topic specified in the configuration will have its partitions assigned to the consumers using the bucket priority logic.
141-
The other topics will have their partitions assigned to consumers using a fallback assignor.
125+
In Kafka, a consumer can subscribe to multiple topics, allowing the same consumer to read messages from partitions belonging to different topics. Because of this, the assignor ensures that only the topic specified in the configuration will have its partitions assigned to the consumers using the bucket priority logic. The other topics will have their partitions assigned to consumers using a fallback assignor.
142126
143127
Here is an example of configuring the fallback assignor to round-robin:
144128

0 commit comments

Comments
 (0)