This is an automated email from the ASF dual-hosted git repository.

chengzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 9fdfdb47af6 Updates Narayana Implementation documentation for 
CoreEnvironmentBean.nodeIdentifier (#30132)
9fdfdb47af6 is described below

commit 9fdfdb47af6a86bd97af75ccbe6978a110b8f392
Author: Ling Hengqian <[email protected]>
AuthorDate: Sun Feb 18 09:17:04 2024 +0800

    Updates Narayana Implementation documentation for 
CoreEnvironmentBean.nodeIdentifier (#30132)
---
 .../special-api/transaction/narayana.cn.md         | 29 ++++++++++++++++++++
 .../special-api/transaction/narayana.en.md         | 32 ++++++++++++++++++++++
 .../jdbc-driver/known-implementation/_index.cn.md  |  2 +-
 .../jdbc-driver/known-implementation/_index.en.md  |  2 +-
 4 files changed, 63 insertions(+), 2 deletions(-)

diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.cn.md
index 04163784ad5..cae88244f01 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.cn.md
@@ -70,6 +70,35 @@ Apache ShardingSphere 提供 XA 事务,集成了 Narayana 的实现。
 
 详情请参见 [Narayana 官方文档](https://narayana.io/documentation/index.html) 。
 
+对于 `jbossts-properties.xml` 的最小配置,ShardingSphere 要求定义 Narayana 的 
`CoreEnvironmentBean.nodeIdentifier` 属性。
+如果 Narayana 的 object store 并非在不同的 Narayana 实例之间共享,你可以将此值设置为 `1`。一个可能的 
`jbossts-properties.xml` 配置如下,
+
+```xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd";>
+<properties>
+    <entry key="CoreEnvironmentBean.nodeIdentifier">1</entry>
+</properties>
+```
+
+在特定情况下,你可能不会希望使用 XML 文件,那你需要在自有 Java 项目的启动类手动设置 
`CoreEnvironmentBean.nodeIdentifier`。
+可参考如下方法调用 Narayana Java API。
+
+```java
+import com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
+
+public class ExampleUtils {
+    public void initNarayanaInstance() {
+        try {
+            arjPropertyManager.getCoreEnvironmentBean().setNodeIdentifier("1");
+        } catch (CoreEnvironmentBeanException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
+```
+
 ### 设置 XA 事务类型
 
 Yaml:
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.en.md
index 320ad53160f..e9401a1fbd0 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/special-api/transaction/narayana.en.md
@@ -69,6 +69,38 @@ Narayana configuration items can be customized by adding 
`jbossts-properties.xml
 
 See [Narayana's Official 
Documentation](https://narayana.io/documentation/index.html) for more details.
 
+For the minimum configuration of `jbossts-properties.xml`,
+ShardingSphere requires that Narayana's `CoreEnvironmentBean.nodeIdentifier` 
property be defined.
+If Narayana 's object store is not shared between different Narayana 
instances, you can set this value to `1`.
+A possible `jbossts-properties.xml` configuration is as follows,
+
+```xml
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd";>
+<properties>
+    <entry key="CoreEnvironmentBean.nodeIdentifier">1</entry>
+</properties>
+```
+
+In certain cases, you may not want to use XML files,
+then you need to manually set `CoreEnvironmentBean.nodeIdentifier` in the 
bootstrap class of your own Java project.
+You can refer to the following methods to call Narayana Java API.
+
+```java
+import com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException;
+import com.arjuna.ats.arjuna.common.arjPropertyManager;
+
+public class ExampleUtils {
+    public void initNarayanaInstance() {
+        try {
+            arjPropertyManager.getCoreEnvironmentBean().setNodeIdentifier("1");
+        } catch (CoreEnvironmentBeanException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
+```
+
 ### Set the XA transaction type
 
 Yaml:
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.cn.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.cn.md
index 81e24e4f6c4..17ff74b4e44 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.cn.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.cn.md
@@ -175,6 +175,6 @@ public class ExampleUtils {
 - `jdbc:shardingsphere:classpath:config.yaml?placeholder-type=system_props`
 - 
`jdbc:shardingsphere:absolutepath:/path/to/config.yaml?placeholder-type=system_props`
 
-### 其他实现
+## 其他实现
 
 具体可参考 https://github.com/apache/shardingsphere-plugin 。
diff --git 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.en.md
 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.en.md
index df0a918cb1f..20c0ec73630 100644
--- 
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.en.md
+++ 
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/known-implementation/_index.en.md
@@ -193,6 +193,6 @@ Example:
 - `jdbc:shardingsphere:classpath:config.yaml?placeholder-type=system_props`
 - 
`jdbc:shardingsphere:absolutepath:/path/to/config.yaml?placeholder-type=system_props`
 
-### Other implementations
+## Other implementations
 
 For details, please refer to https://github.com/apache/shardingsphere-plugin.

Reply via email to