I am trying to set external transaction manager for Ignite Cache , however it appers that Factory is ignored and create is not called...
The Factory Implementation is:
public class TransactionManagerFactory implements Factory<TransactionManager> {
private static final long serialVersionUID = 1L;
private transient IgniteCache igniteCache;
public TransactionManagerFactory(IgniteCache igniteCache) {
this.igniteCache=igniteCache;
}
@Override
public TransactionManager create() {
return this.igniteCache.getTransactionManager();
}
}
The Ignite transaction client configuration is set is following:
TransactionConfiguration txConfiguration=new TransactionConfiguration();
txConfiguration.setDeadlockTimeout(acquireTimeout);
txConfiguration.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);
txConfiguration.setDefaultTxConcurrency(TransactionConcurrency.PESSIMISTIC);
TransactionManagerFactory txFactory=new TransactionManagerFactory(this);
txConfiguration.setTxManagerFactory(txFactory);
this.clientConfig.setTransactionConfiguration(txConfiguration);
The cache is getting created as:
CacheConfiguration<Object, Object> cacheCfg = new CacheConfiguration<Object, Object>(this.name);
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
this.cache = this.instance.getOrCreateCache(cacheCfg);
However when in tests cache is created and connected to remote node and transaction is created by calling transactionManager.begin();
The instance.transactions().tx() is returning null , while transactionManager.getTransaction() return TransactionImpl{xid=Xid{formatId=1, globalTransactionId=8EA3F99497B60948C0E22AEBA1F54C460000000000000002,branchQualifier=8EA3F99497B60948C0E22AEBA1F54C460000000000000002}, status=ACTIVE}
And whenever the transaction is rolled back , the wrotten items persist in cache.
Also TransactionManagerFactory.create is not executed at any time.
How can i correctly integrate external transaction manager with ignite cache?
BR
Yulian Oifa
question from:
https://stackoverflow.com/questions/66065287/ignite-factorytransactionmanager-is-ignored 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…