This is an automated email from the ASF dual-hosted git repository.
jianbin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-seata-samples.git
The following commit(s) were added to refs/heads/master by this push:
new a8714aee bugfix:XA mode feature requires passing xid (#702)
a8714aee is described below
commit a8714aee8bb4a788a439da295f5a5c9ba10315f8
Author: shukai <[email protected]>
AuthorDate: Fri Sep 26 15:35:55 2025 +0800
bugfix:XA mode feature requires passing xid (#702)
---
.../seata/interceptor/FeignRequestInterceptor.java | 20 ++++++++++++++++++++
.../seata/interceptor/FeignRequestInterceptor.java | 20 ++++++++++++++++++++
.../seata/interceptor/FeignRequestInterceptor.java | 20 ++++++++++++++++++++
.../seata/interceptor/FeignRequestInterceptor.java | 20 ++++++++++++++++++++
4 files changed, 80 insertions(+)
diff --git
a/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-account/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-account/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
new file mode 100644
index 00000000..f7ff106a
--- /dev/null
+++
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-account/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
@@ -0,0 +1,20 @@
+package org.apache.seata.interceptor;
+
+import org.apache.seata.core.context.RootContext;
+import org.springframework.context.annotation.Configuration;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+
+@Configuration
+public class FeignRequestInterceptor implements RequestInterceptor {
+
+ @Override
+ public void apply(RequestTemplate template) {
+ // 从全局事务上下文中获取 TX_XID 并添加到 Feign 请求的 Header 中
+ String xid = RootContext.getXID();
+ if (xid != null) {
+ template.header(RootContext.KEY_XID, xid);
+ }
+ }
+}
\ No newline at end of file
diff --git
a/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-business/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-business/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
new file mode 100644
index 00000000..f7ff106a
--- /dev/null
+++
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-business/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
@@ -0,0 +1,20 @@
+package org.apache.seata.interceptor;
+
+import org.apache.seata.core.context.RootContext;
+import org.springframework.context.annotation.Configuration;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+
+@Configuration
+public class FeignRequestInterceptor implements RequestInterceptor {
+
+ @Override
+ public void apply(RequestTemplate template) {
+ // 从全局事务上下文中获取 TX_XID 并添加到 Feign 请求的 Header 中
+ String xid = RootContext.getXID();
+ if (xid != null) {
+ template.header(RootContext.KEY_XID, xid);
+ }
+ }
+}
\ No newline at end of file
diff --git
a/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-order/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-order/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
new file mode 100644
index 00000000..f7ff106a
--- /dev/null
+++
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-order/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
@@ -0,0 +1,20 @@
+package org.apache.seata.interceptor;
+
+import org.apache.seata.core.context.RootContext;
+import org.springframework.context.annotation.Configuration;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+
+@Configuration
+public class FeignRequestInterceptor implements RequestInterceptor {
+
+ @Override
+ public void apply(RequestTemplate template) {
+ // 从全局事务上下文中获取 TX_XID 并添加到 Feign 请求的 Header 中
+ String xid = RootContext.getXID();
+ if (xid != null) {
+ template.header(RootContext.KEY_XID, xid);
+ }
+ }
+}
\ No newline at end of file
diff --git
a/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-storage/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-storage/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
new file mode 100644
index 00000000..f7ff106a
--- /dev/null
+++
b/xa-sample/springboot-feign-seata-xa/springboot-feign-seata-storage/src/main/java/org/apache/seata/interceptor/FeignRequestInterceptor.java
@@ -0,0 +1,20 @@
+package org.apache.seata.interceptor;
+
+import org.apache.seata.core.context.RootContext;
+import org.springframework.context.annotation.Configuration;
+
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+
+@Configuration
+public class FeignRequestInterceptor implements RequestInterceptor {
+
+ @Override
+ public void apply(RequestTemplate template) {
+ // 从全局事务上下文中获取 TX_XID 并添加到 Feign 请求的 Header 中
+ String xid = RootContext.getXID();
+ if (xid != null) {
+ template.header(RootContext.KEY_XID, xid);
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]