jms - Distributed Transaction management in Core Java application -
Text after "div class =" itemprop = "text">
Is it possible to use the core distributed in Java application to the transaction manager that does not run inside any container?
I have an application that reads messages from JMS queue and writes it in the database if the database is written then the full transaction should roll back. I think of using JOTM But I'm not sure how to configure it, it is also not certain that such a configuration is possible at all because the application does not run on any server. Any suggestion would be really helpful. Thanks in advance.
After text "itemprop =" text ">
How to configure JTA outside of the container. JOTM is one of the options described.
For your case, it will be easy to use Junk to JTA just use ChainedTransactionManager. You have almost the same effect with minimum spring configuration as configured below, and then @transactional (value = "chainedTransactionManager") on your listener.
@Bean JmsTransactionManager jmsTransactionManager (ConnectionFactory connectionFactory) {JmsTransactionManager Manager Specified = New JmsTransactionManager (); Manager.setConnectionFactory (connectionFactory); Return manager; } @Bean JpaTransactionManager jpaTransactionManager () {JpaTransactionManager Manager = New JpaTransactionManager (); Return manager; } // Without the upper part of the JAPA, together, TM was used to commit JMS and JPA. Note that JMS should be listed first, because there is a possibility of failure in transactions and JM less in reverse order. @Bean ChainedTransactionManager chainedTransactionManager (JmsTransactionManager jmsTransactionManager, JpaTransactionManager jpaTransactionManager) {ChainedTransactionManager manager = new ChainedTransactionManager (jmsTransactionManager, jpaTransactionManager); Return manager; }
Comments
Post a Comment