Skip to content

Commit dc6d0d0

Browse files
committed
Transaction Doc Polishing
1 parent 0e411db commit dc6d0d0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/reference/asciidoc/kafka.adoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3194,19 +3194,20 @@ Instead, a new "nested" transaction is used.
31943194
===== `transactionIdPrefix`
31953195

31963196
As mentioned in <<transactions, the overview>>, the producer factory is configured with this property to build the producer `transactional.id` property.
3197-
There is rather a dichotomy when specifying this property in that, when running multiple instances of the application, it must be the same on all instances to satisfy fencing zombies (also mentioned in the overview) when producing records on a listener container thread.
3197+
There is a dichotomy when specifying this property in that, when running multiple instances of the application with `EOSMode.ALPHA`, it must be the same on all instances to satisfy fencing zombies (also mentioned in the overview) when producing records on a listener container thread.
31983198
However, when producing records using transactions that are **not** started by a listener container, the prefix has to be different on each instance.
31993199
Version 2.3, makes this simpler to configure, especially in a Spring Boot application.
32003200
In previous versions, you had to create two producer factories and `KafkaTemplate` s - one for producing records on a listener container thread and one for stand-alone transactions started by `kafkaTemplate.executeInTransaction()` or by a transaction interceptor on a `@Transactional` method.
32013201

32023202
Now, you can override the factory's `transactionalIdPrefix` on the `KafkaTemplate` and the `KafkaTransactionManager`.
32033203

32043204
When using a transaction manager and template for a listener container, you would normally leave this to default to the producer factory's property.
3205-
This value should be the same for all application instances.
3205+
This value should be the same for all application instances when using `EOSMode.ALPHA`.
3206+
With `EOSMode.BETA` it is no longer necessary to use the same `transactional.id`, even for consumer-initiated transactions; in fact, it must be unique on each instance the same as producer-initiated transactions.
32063207
For transactions started by the template (or the transaction manager for `@Transaction`) you should set the property on the template and transaction manager respectively.
32073208
This property must have a different value on each application instance.
32083209

3209-
This problem has been eliminated when `EOSMode.BETA` is being used (with broker versions >= 2.5); see <<exactly-once>>.
3210+
This problem (different rules for `transactional.id`) has been eliminated when `EOSMode.BETA` is being used (with broker versions >= 2.5); see <<exactly-once>>.
32103211

32113212
[[tx-template-mixed]]
32123213
===== `KafkaTemplate` Transactional and non-Transactional Publishing
@@ -3318,6 +3319,8 @@ You can then do a rolling upgrade of your application with `producerPerConsumerP
33183319

33193320
If your brokers are already 2.5 or newer, you should set the `DefaultKafkaProducerFactory` `producerPerConsumerPartition` property to `false`, to reduce the number of producers needed.
33203321

3322+
IMPORTANT: When using `EOSMode.BETA` with `producerPerConsumerPartition=false` the `transactional.id` must be unique across all application instances.
3323+
33213324
When using `BETA` mode, it is no longer necessary to set the `subBatchPerPartition` to `true`; it will default to `false` when the `EOSMode` is `BETA`.
33223325

33233326
Refer to https://cwiki.apache.org/confluence/display/KAFKA/KIP-447%3A+Producer+scalability+for+exactly+once+semantics[KIP-447] for more information.

0 commit comments

Comments
 (0)