Do you use Ignite as a distributed cache of your database? If it’s so, then
you can hook Ignite up with the database using CacheStore interface. After
that, Ignite will write-through changes automatically including
transactions.

Denis

On Friday, March 23, 2018, Prasad Bhalerao <prasadbhalerao1...@gmail.com>
wrote:

> Can someone please answer this?
> I am also facing the similar problem.
>
>
>
>
> On Fri, Mar 23, 2018, 5:12 PM akash shinde <akashshi...@gmail.com> wrote:
>
>> Hello,
>>      My requirement is to achieve ignite cache update operation and
>> database write operation in single transaction.
>> Right now I am trying to use  JTA transaction management. I have created
>> below IgniteConfiguration  using transactionConfiguration. But I am not
>> sure how to configure XAResource to this transaction manager.
>> I will be needing two XAResource here 1)Datasource(JDBC data source)
>> 2)Ignite cache.
>>
>> Please suggest how can I achieve this JTA transaction using two
>> XAResources.
>>
>> Please also suggest after all these configuration how to
>> get JtaTransactionManager instance to initiate the transaction. Currently
>> I am using Narayana JTA implementation.
>>
>>
>> private IgniteConfiguration getIgniteConfiguration(IgniteSpringBean ignite) {
>>
>>   IgniteConfiguration cfg = new IgniteConfiguration();
>>   cfg.setIgniteInstanceName("springDataNode");
>>   cfg.setPeerClassLoadingEnabled(false);
>>   cfg.setRebalanceThreadPoolSize(4);
>>
>>  * cfg.setTransactionConfiguration(transactionConfiguration());*
>>
>>   
>> cfg.setCacheConfiguration(getIPContainerCacheConfiguration(),getIPContainerIPV4CacheConfiguration(),getUserPermissionCacheConfiguration(),getUserAccountCacheConfiguration());
>>   return cfg;
>> }
>>
>>
>> @Bean
>> public TransactionConfiguration transactionConfiguration(){
>>   TransactionConfiguration configuration = new TransactionConfiguration();
>>   Factory factory = new Factory() {
>>     @Override
>>     public Object create() {
>>       return jtaTransactionManager();
>>     }
>>   };
>>   configuration.setTxManagerFactory(factory);
>>   *configuration.setUseJtaSynchronization(true);*
>>   return configuration;
>> }
>>
>> @Bean
>> public PlatformTransactionManager jtaTransactionManager() {
>>   JtaTransactionManager tm = new JtaTransactionManager();
>>   tm.setTransactionManager(transactionManager());
>>   return tm;
>> }
>>
>> @Bean
>> public TransactionManager transactionManager() {
>>   return new TransactionManagerImple();
>> }
>>
>>
>> Thanks,
>> Akash
>>
>

Reply via email to