Hi I have two different database and I need distributed transaction for my process.
Chained transaction manager is deprecated
(https://github.com/spring-projects/spring-data-commons/issues/2232)
And after spring boot 3.0 ,spring doesnt support jta solution like atomikos
(https://github.com/atomikos/transactions-essentials/issues/175)
(https://github.com/spring-projects/spring-boot/issues/20809)
So with spring boot 3.0 what is the best way to manage distributed transaction management
Related
I have a spring boot application using generic maven components - one for IBM MQ configuration and the other for database configuration. Both these maven components were developed by us.
We need to setup XA transaction in this application to ensure that input MQ messages coming into the application via IBM MQ and then persists the message to Database.
We are planning to use Atomikos transaction manager.
My query is - Do we need separate transaction manager configured i.e. one each for JDBC and MQ (JMS) here?
You can use the standard machinery to deal with distributed (or local) transactions but you need configure some transaction manager.
If you use Java enterprise services, the use of transaction for JMS are described (e.g.) here, here and here (typically the #Transactional annotation).
If not, for spring boot you can configure, without special coding (i.e. using again #Transactional), the atomikos transaction manager as described here. Basically:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jta-atomikos</artifactId>
</dependency>
I am facing issues while creating a Multitenant application using spring boot and Redis. I have used the same solution which is mentioned in How to implement multitenancy for Redis in spring boot. But it didn't work. Is there a different way to implement Redis multitenancy with Spring boot.
I found the solution by adding a check if the data source not available in the cache then pull from the required source and create a connection. Also changed calling afterPropertiesSet() explicitly which is mentioned in How to implement multitenancy for redis in spring boot
I am using spring boot app with mongodb, and postgres. And use spring data to interact with db. Need auditing for the changes which happen in the app. Currently exploring javers to do this. But is there any way where i can achieve auditing at migration level as well.
I have read the Spring Boot documentation and I got knowledge about Spring Session from this document.
But I see that HttpSession class works without adding any dependencies in my code.
JDBC
Redis
Hazelcast
MongoDB
So...
I'm guessing that Spring Boot provides Session Storage by default. Does anyone know about this? I looked at spring docs but couldn't find it.
How to you run your app? Do you use Tomcat or Jetty embedded server or deploy it in those servers? They all have their own session storage implementation. Tomcat uses file-bases session storage by default.
The session storage that you mentioned by default is provided by the Servlet container.It is just an internal java.util.Map.
Spring Session is a Spring sub-project. It is optional and its purpose is to allow you swap the session stroage mechanism provided by the container with the one provided by Spring Session which can be RDBMS, Redis ,Hazelcast Cluster or MongoDB .HttpSession is then stored in the container agnostic way such that you can have session persistence /session clustering more easier. You no longer need to consult the Servlet container documentation for how to configure a cluster etc.
If you want to use Spring session, you still have to include the dependencies from the spring session project.
Trying to wrap my head around JTA and have arbitrarily chosen Bitronix as the impl because the documentation was easier to get to (as opposed to Atmikos which makes you sign-up and register in order to get at the src/docs/jars/etc.).
If I want to use Bitronix to be my JTA implementation (using Tomcat & GlassFish), then what is its basic architecture (which may just be the basic architecture of JTA itself)? Is a transaction manager an actual server/runtime that I connect to (like a JMS broker)? Or is this just an API that I can configure and hit whenever I need a transaction?
My understanding of JTA is that there is:
Your code
A resource manager - adaptor for some ACID-compliant persistence (like a datastore or message broker)
A transaction manager - manages transaction API calls between your code and the resource
manager
Is Bitronix just the transaction manager and if so is it a separate application, a separate JAR/WAR that has to be deployed alongside yours, or does it run "embedded" inside your app? Thanks in advance!
It runs embedded inside Tomcat, and is accessible through JNDI, like all other JTA transaction managers. The whole process of embedding Bitronix with Tomcat is described here.
Note that there is no reason to use Bitronix with Glassfish, since Glassfish is a full-stack Java EE app server and thus already has a JTA transaction manager.