diff --git a/docs/src/main/asciidoc/overview.adoc b/docs/src/main/asciidoc/overview.adoc index 0252f7604..8fd02967a 100644 --- a/docs/src/main/asciidoc/overview.adoc +++ b/docs/src/main/asciidoc/overview.adoc @@ -583,10 +583,14 @@ If you wish to use transactions in a source application, or from some arbitrary [source, java] ---- @Bean -public PlatformTransactionManager transactionManager(BinderFactory binders) { +public PlatformTransactionManager transactionManager(BinderFactory binders, + @Value("${unique.tx.id.per.instance}") String txId) { + ProducerFactory pf = ((KafkaMessageChannelBinder) binders.getBinder(null, MessageChannel.class)).getTransactionalProducerFactory(); - return new KafkaTransactionManager<>(pf); + KafkaTransactionManager tm = new KafkaTransactionManager<>(pf); + tm.setTransactionId(txId) + return tm; } ---- ==== @@ -613,6 +617,8 @@ public static class Sender { If you wish to synchronize producer-only transactions with those from some other transaction manager, use a `ChainedTransactionManager`. +IMPORTANT: If you deploy multiple instances of your application, each instance needs a unique `transactionIdPrefix`. + [[kafka-error-channels]] === Error Channels