Igniters:

I'm unsuccessfully establishing an XA transaction manager to associate with my 
ignite configuration.

I don't know the JNDI name location of my java transaction manager (not to be 
confused with the spring transaction manager which implements 
TransactionManagerPlatform).

Here is a snippet of my code (with pieces omitted for brevity):

...

import javax.cache.configuration.Factory;
import javax.transaction.TransactionManager;

import org.apache.ignite.configuration.TransactionConfiguration;

import org.apache.ignite.cache.jta.jndi.CacheJndiTmFactory;
...

@Autowired(required = false)
TransactionManager transactionManager;

...

private TransactionConfiguration doTransactionConfiguration() {
    TransactionConfiguration configuration = new TransactionConfiguration();

    if (null == transactionManager) {
        CacheJndiTmFactory txManagerFactory = new CacheJndiTmFactory();
        // see 
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-jta.html
 for these names
        String[] jndiNames = 
{"java:comp/UserTransaction","java:comp/TransactionManager","java:/TransactionManager"};
        txManagerFactory.setJndiNames(jndiNames);
        configuration.setTxManagerFactory(txManagerFactory);
    } else {

        Factory<TransactionManager> txManagerFactory = new 
Factory<TransactionManager>() {
            @Override
            public TransactionManager create() {
                return jtaTransactionManager();
            }
        };

        configuration.setTxManagerFactory(txManagerFactory);

    }
    return configuration;
}

private TransactionManager jtaTransactionManager() {
    return transactionManager;
}





public IgniteConfiguration doit() {

    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setTransactionConfiguration(doTransactionConfiguration());

    return cfg;

}

Here is a snippet of my code (with pieces omitted for brevity):
When I execute the public method "do it", the autowire fails to load (I do not 
require it) and none of the jndi locations that I listed seem to have the "java 
TransactionManager" (again - not to be confused with the bean named 
"TransactionManager" that does not implement TransactionManager, but instead 
implements TransactionManagerPlatform).

What is the right way to associate the xa manager that is setup with spring - 
which I don't know in advance, with ignite?

Thanks,

SCott

Reply via email to