mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 08:41:22 +00:00
Merge pull request #4806 from ochaloup/issue4765-harmonise-node-name-xa-node-name
[#4765] fix node name to be harmonized with xa node name
This commit is contained in:
@@ -186,6 +186,22 @@ include::duration-format-note.adoc[]
|
||||
|
||||
The default value is 60 seconds.
|
||||
|
||||
== Configuring transaction node name identifier
|
||||
|
||||
Narayana, as the underlaying transaction manager, has an concept of unique node identifier.
|
||||
This is important if you consider to use XA transactions with involve multiple resources.
|
||||
|
||||
The node name identifier plays a crucial part in the identification of a transaction.
|
||||
The node name identifier is forged into the transaction id when the transaction is created.
|
||||
Based on the node name identifier the transaction manager is capable to recognized the XA tranaction
|
||||
counterparts created in database or JMS broker. The identifier makes possible for the transaction manager
|
||||
to roll-back the transaction counterparts during recovery.
|
||||
|
||||
The node name identifier needs to be unique per transaction manager deployment.
|
||||
And the node identifier needs to be stable over the transaction manager restarts.
|
||||
|
||||
The node name identifier may be configured via the property `quarkus.transaction-manager.node-name`.
|
||||
|
||||
== Why always having a transaction manager?
|
||||
|
||||
Does it work everywhere I want to?::
|
||||
@@ -225,4 +241,3 @@ It's not a mess in Quarkus :)
|
||||
Resource-level was introduced to support JPA in a non managed environment.
|
||||
But Quarkus is both lean and a managed environment so we can safely always assume we are in JTA mode.
|
||||
The end result is that the difficulties of running Hibernate ORM + CDI + a transaction manager in Java SE mode are solved by Quarkus.
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.quarkus.narayana.jta.runtime;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Collections;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
@@ -8,6 +9,7 @@ import org.jboss.logging.Logger;
|
||||
import com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException;
|
||||
import com.arjuna.ats.arjuna.common.arjPropertyManager;
|
||||
import com.arjuna.ats.arjuna.coordinator.TxControl;
|
||||
import com.arjuna.ats.jta.common.jtaPropertyManager;
|
||||
import com.arjuna.common.util.propertyservice.PropertiesFactory;
|
||||
|
||||
import io.quarkus.runtime.annotations.Recorder;
|
||||
@@ -23,7 +25,8 @@ public class NarayanaJtaRecorder {
|
||||
|
||||
try {
|
||||
arjPropertyManager.getCoreEnvironmentBean().setNodeIdentifier(transactions.nodeName);
|
||||
TxControl.setXANodeName(transactions.xaNodeName.orElse(transactions.nodeName));
|
||||
jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Collections.singletonList(transactions.nodeName));
|
||||
TxControl.setXANodeName(transactions.nodeName);
|
||||
} catch (CoreEnvironmentBeanException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -46,6 +49,7 @@ public class NarayanaJtaRecorder {
|
||||
|
||||
public void setDefaultTimeout(TransactionManagerConfiguration transactions) {
|
||||
transactions.defaultTransactionTimeout.ifPresent(defaultTimeout -> {
|
||||
arjPropertyManager.getCoordinatorEnvironmentBean().setDefaultTimeout((int) defaultTimeout.getSeconds());
|
||||
TxControl.setDefaultTimeout((int) defaultTimeout.getSeconds());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,12 +18,6 @@ public final class TransactionManagerConfiguration {
|
||||
@ConfigItem(defaultValue = "quarkus")
|
||||
public String nodeName;
|
||||
|
||||
/**
|
||||
* The XA node name used by the transaction manager
|
||||
*/
|
||||
@ConfigItem()
|
||||
public Optional<String> xaNodeName;
|
||||
|
||||
/**
|
||||
* The default transaction timeout
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user