Class PulsarTransactionManager

java.lang.Object
org.springframework.transaction.support.AbstractPlatformTransactionManager
org.springframework.pulsar.transaction.PulsarTransactionManager
All Implemented Interfaces:
Serializable, PulsarAwareTransactionManager, ConfigurableTransactionManager, PlatformTransactionManager, TransactionManager

public class PulsarTransactionManager extends AbstractPlatformTransactionManager implements PulsarAwareTransactionManager
Binds a native Pulsar transaction from the specified PulsarClient to the current thread, allowing for one transaction per thread per Pulsar client.

This transaction manager is not able to provide XA transactions, for example in order to share transactions between messaging and database access.

Application code is required to retrieve the transactional Pulsar resources via PulsarTransactionUtils.obtainResourceHolder(org.apache.pulsar.client.api.PulsarClient, java.time.Duration). The PulsarTemplate will auto-detect a thread-bound transaction and automatically participate in it.

Transaction synchronization is turned off by default, as this manager might be used alongside a datastore-based Spring transaction manager such as the JDBC DataSourceTransactionManager, which has stronger needs for synchronization.

Since:
1.1.0
Author:
Chris Bono
See Also: