Skip to content

Commit 507945e

Browse files
garyrussellartembilan
authored andcommitted
GH-784: Doc polishing
Resolves #784
1 parent 95d442a commit 507945e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/reference/asciidoc/kafka.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ public void sendToKafka(final MyOutputData data) {
246246
[[transactions]]
247247
===== Transactions
248248

249+
====== Overview
250+
249251
The 0.11.0.0 client library added support for transactions.
250252
Spring for Apache Kafka adds support in several ways.
251253

@@ -273,11 +275,13 @@ If a transaction is active, any `KafkaTemplate` operations performed within the
273275
The manager will commit or rollback the transaction depending on success or failure.
274276
The `KafkaTemplate` must be configured to use the same `ProducerFactory` as the transaction manager.
275277

276-
====== Transactional Listener Container
278+
====== Transactional Listener Container and Exactly Once Processing
277279

278-
You can provide a listener container with a `KafkaTransactionManager` instance; when so configured, the container will start a transaction before invoking the listener.
280+
You can provide a listener container with a `KafkaAwareTransactionManager` instance; when so configured, the container will start a transaction before invoking the listener.
281+
Any `KafkaTemplate` operations performed by the listener will participate in the transaction.
279282
If the listener successfully processes the record (or records when using a `BatchMessageListener`), the container will send the offset(s) to the transaction using `producer.sendOffsetsToTransaction()`), before the transaction manager commits the transaction.
280-
If the listener throws an exception, the transaction is rolled back and the consumer is repositioned so that the rolled-back records will be retrieved on the next poll.
283+
If the listener throws an exception, the transaction is rolled back and the consumer is repositioned so that the rolled-back record(s) will be retrieved on the next poll.
284+
See <<after-rollback>> for more information and for handling records that repeatedly fail.
281285

282286
====== Transaction Synchronization
283287

@@ -2195,7 +2199,7 @@ This is to cause the transaction to roll back (if transactions are enabled).
21952199
[[after-rollback]]
21962200
===== After Rollback Processor
21972201

2198-
When using transactions, if the listener container throws an exception (and an error handler, if present, throws an exception), the transaction is rolled back.
2202+
When using transactions, if the listener throws an exception (and an error handler, if present, throws an exception), the transaction is rolled back.
21992203
By default, any unprocessed records (including the failed record) will be re-fetched on the next poll.
22002204
This is achieved by performing `seek` operations in the `DefaultAfterRollbackProcessor`.
22012205
With a batch listener, the entire batch of records will be reprocessed (the container has no knowledge of which record in the batch failed).

0 commit comments

Comments
 (0)