Narayana is a popular open source JTA transaction manager implementation supported by Red Hat. To use Narayana JTA in your Spring Boot application you can use You can use the narayana-spring-boot-starter
starter to add the appropriate Narayana dependencies to your application.
NARAYANA pom.xml Dependencies
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jta-narayana</artifactId>
</dependency>
Spring Boot automatically configures Narayana with default values and post-processes your beans to ensure that startup and shutdown ordering is correct.
NARAYANA Spring Boot Properties
Spring Boot load these properties in NarayanaProperties class with default values you can overwrite these values in your application application.properties/ application.yaml.
Name | Default Value | Description |
spring.jta.narayana.default-timeout | 60 | Transaction timeout.(in second) |
spring.jta.narayana.expiry-scanners | com.arjuna.ats.internal. arjuna.recovery. ExpiredTransactionStatusManagerScanner | Comma-separated list of expiry scanners. |
spring.jta.narayana.log-dir | Transaction object store directory. | |
spring.jta.narayana.one-phase-commit | true | Enable one phase commit optimisation. |
spring.jta.narayana.periodic-recovery-period | 120 | Interval in which periodic recovery scans are performed.(in second) |
spring.jta.narayana.recovery-backoff-period | 10 | Back off period between first and second phases of the recovery scan.(in second) |
spring.jta.narayana.recovery-db-pass | Database password for recovery manager. | |
spring.jta.narayana.recovery-db-user | Database username for recovery manager. | |
spring.jta.narayana.recovery-jms-pass | JMS password for recovery manager. | |
spring.jta.narayana.recovery-jms-user | JMS username for recovery manager. | |
spring.jta.narayana.recovery-modules | Comma-separated recovery modules. | |
spring.jta.narayana.transaction-manager-id | 1 | Unique transaction manager id. |
spring.jta.narayana.xa-resource-orphan-filters | Comma-separated orphan filters. |
By default, Narayana transaction logs written location is transaction-logs
directory in your application home directory (the directory in which your application jar file resides). You can customize the location of this directory by setting the narayana.log-dir or spring.jta.log-dir similar to that you can also customize the other properties.
References
- https://docs.spring.io/spring-boot/docs/1.4.x/reference/html/common-application-properties.html
- https://github.com/snowdrop/narayana-spring-boot
Happy Learning !!!