org.apache.ignite.transactions.spring

## Class IgniteClientSpringTransactionManager

- java.lang.Object
- - org.springframework.transaction.support.AbstractPlatformTransactionManager
  - - org.apache.ignite.transactions.spring.AbstractSpringTransactionManager
    - - org.apache.ignite.transactions.spring.IgniteClientSpringTransactionManager

- All Implemented Interfaces:
    Serializable, EventListener, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>, org.springframework.transaction.PlatformTransactionManager, org.springframework.transaction.support.ResourceTransactionManager

      public class IgniteClientSpringTransactionManager
      extends AbstractSpringTransactionManager

  Represents `AbstractSpringTransactionManager` implementation that uses thin client to access the cluster and manage transactions. It requires thin client instance to be set before manager use (see `setClientInstance(IgniteClient)`). You can provide ignite client instance to a Spring configuration XML file, like below:

       <beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:tx="http://www.springframework.org/schema/tx"
              xsi:schemaLocation="
                  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
           <-- Provide Ignite client instance. -->
           <bean id="transactionManager" class="org.apache.ignite.transactions.spring.IgniteClientSpringTransactionManager">
               <property name="clientInstance" ref="igniteClientBean"/>
           </bean>

           <-- Use annotation-driven transaction configuration. -->
           <tx:annotation-driven/>
       </beans>

  Note that the same thin client instance must be used to both initialize the transaction manager and perform transactional operations.
  See Also:
    `to configure Transaction Manager access to the cluster through the Ignite client node.`, Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.ignite.transactions.spring.AbstractSpringTransactionManager

      `AbstractSpringTransactionManager.IgniteTransactionObject`

    - ### Nested classes/interfaces inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager

      `org.springframework.transaction.support.AbstractPlatformTransactionManager.SuspendedResourcesHolder`

  - ### Field Summary

    - ### Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager

      `logger, SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteClientSpringTransactionManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.apache.ignite.internal.transactions.proxy.TransactionProxyFactory` | `createTransactionFactory()` Creates instance of `TransactionProxyFactory` that will be used to start new Ignite transactions.
    `protected TransactionConcurrency` | `defaultTransactionConcurrency()`
    `protected TransactionIsolation` | `defaultTransactionIsolation()`
    `protected long` | `defaultTransactionTimeout()`
    `protected void` | `doSetRollbackOnly(org.springframework.transaction.support.DefaultTransactionStatus status)`
    `IgniteClient` | `getClientInstance()`
    `protected IgniteLogger` | `log()`
    `void` | `onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent evt)`
    `void` | `setClientInstance(IgniteClient cli)` Sets thin client instance that is used for accessing the Ignite cluster.

    - ### Methods inherited from class org.apache.ignite.transactions.spring.AbstractSpringTransactionManager

      `doBegin, doCleanupAfterCompletion, doCommit, doGetTransaction, doRollback, getResourceFactory, getTransactionConcurrency, isExistingTransaction, setTransactionConcurrency`

    - ### Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager

      `commit, determineTimeout, doResume, doSuspend, getDefaultTimeout, getTransaction, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, newTransactionStatus, prepareForCommit, prepareSynchronization, prepareTransactionStatus, registerAfterCompletionWithExistingTransaction, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, shouldCommitOnGlobalRollbackOnly, suspend, triggerBeforeCommit, triggerBeforeCompletion, useSavepointForNestedTransaction`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.springframework.transaction.PlatformTransactionManager

      `commit, getTransaction, rollback`

- - ### Constructor Detail

    - #### IgniteClientSpringTransactionManager

          public IgniteClientSpringTransactionManager()

  - ### Method Detail

    - #### getClientInstance

          public IgniteClient getClientInstance()

      Returns:
        Thin client instance that is used for accessing the Ignite cluster.

    - #### setClientInstance

          public void setClientInstance(IgniteClient cli)

      Sets thin client instance that is used for accessing the Ignite cluster.

    - #### onApplicationEvent

          public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent evt)

      Specified by:
        `onApplicationEvent` in interface `org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>`
      Overrides:
        `onApplicationEvent` in class `AbstractSpringTransactionManager`

    - #### defaultTransactionIsolation

          protected TransactionIsolation defaultTransactionIsolation()

      Specified by:
        `defaultTransactionIsolation` in class `AbstractSpringTransactionManager`
      Returns:
        Default transaction isolation.

    - #### defaultTransactionTimeout

          protected long defaultTransactionTimeout()

      Specified by:
        `defaultTransactionTimeout` in class `AbstractSpringTransactionManager`
      Returns:
        Default transaction timeout.

    - #### defaultTransactionConcurrency

          protected TransactionConcurrency defaultTransactionConcurrency()

      Specified by:
        `defaultTransactionConcurrency` in class `AbstractSpringTransactionManager`
      Returns:
        Default transaction concurrency.

    - #### createTransactionFactory

          protected org.apache.ignite.internal.transactions.proxy.TransactionProxyFactory createTransactionFactory()

      Creates instance of `TransactionProxyFactory` that will be used to start new Ignite transactions.
      Specified by:
        `createTransactionFactory` in class `AbstractSpringTransactionManager`

    - #### log

          protected IgniteLogger log()

      Specified by:
        `log` in class `AbstractSpringTransactionManager`
      Returns:
        Ignite logger.

    - #### doSetRollbackOnly

          protected void doSetRollbackOnly(org.springframework.transaction.support.DefaultTransactionStatus status)
                                    throws org.springframework.transaction.TransactionException

      Overrides:
        `doSetRollbackOnly` in class `AbstractSpringTransactionManager`
      Throws:
        `org.springframework.transaction.TransactionException`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021