Add Spring Pulsar transaction support

Adds auto-config for Spring for Apache Pulsar transactions.

Introduces a new `spring.pulsar.transaction.enabled` property
which can be used to enable transactions. This feature is
opt-in and remains disabled by default.

See gh-40189

Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
Co-authored-by: Phillip Webb <phil.webb@broadcom.com>
This commit is contained in:
Chris Bono
2024-04-07 23:36:31 -05:00
committed by Phillip Webb
parent 07f82744f1
commit 08ad7aa444
7 changed files with 182 additions and 5 deletions

View File

@@ -215,6 +215,26 @@ TIP: For more details on any of the above components and to discover other avail
[[messaging.pulsar.transactions]]
== Transaction Support
Spring for Apache Pulsar supports transactions when using `PulsarTemplate` and `@PulsarListener`.
NOTE: Transactions are not currently supported when using the reactive variants.
Setting the configprop:spring.pulsar.transaction.enabled[] property to `true` will:
* Configure a `PulsarTransactionManager` bean
* Enable transaction support for `PulsarTemplate`
* Enable transaction support for `@PulsarListener` methods
The `transactional` attribute of `@PulsarListener` can be used to fine-tune when transactions should be used with listeners.
For more control of the Spring for Apache Pulsar transaction features you should define your own `PulsarTemplate` and/or `ConcurrentPulsarListenerContainerFactory` beans.
You can also define a `PulsarAwareTransactionManager` bean if the default auto-configured `PulsarTransactionManager` is not suitable.
[[messaging.pulsar.additional-properties]]
== Additional Pulsar Properties