You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KafkaProducer<K, V> producer = new KafkaProducer<>(configs);
45
45
```
46
46
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.
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 foreach one of them. The partition allocation is specifiedin terms of percentage. Note that the usage of the symbol `%` is optional.
@@ -68,10 +62,7 @@ In case of the allocation result in some partitions being left behind because th
68
62
69
63
### Messages and buckets
70
64
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:
KafkaConsumer<K, V> consumer = new KafkaConsumer<>(configs);
106
97
```
107
98
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.
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.
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.
142
126
143
127
Here is an example of configuring the fallback assignor to round-robin:
0 commit comments