Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dubbo整合seata,同一个工程下xid丢失 #265

Open
markr512 opened this issue Dec 25, 2023 · 4 comments
Open

dubbo整合seata,同一个工程下xid丢失 #265

markr512 opened this issue Dec 25, 2023 · 4 comments

Comments

@markr512
Copy link

markr512 commented Dec 25, 2023

在同一个工程下
dubbo整合seata
工程内既有服务端又有客户端,会出现xid丢失现象
dubbo版本3.1.11 seata版本1.6.1
rpxXid和unbindXid相等,服务端filter解绑之后不会赋值xid,导致丢失

123

@AlbumenJ
Copy link
Member

@funkye PTAL

@aofall
Copy link
Contributor

aofall commented Apr 7, 2024

According to the official seata documentation, it is released after each the RPC call is completed.

I think is not a bug. Seata is prepared for distributed transactions, if you write business in singleton application, you don't need to use seata, or you can write related transaction logic in the same place, or you can maintain the xid yourself in the business logic like this.

class BusinessImpl {
    @GlobalTransactional
    public void business() {
        String xid = RootContext.getXID()
        // do dubbo injvm invoke business1
        // rebind xid again
        RootContext.bind(xid);
        // do dubbo injvm invoke business2
    }
}
class Business2Impl {
    @GlobalTransactional
    public void business2() {
        String xid = RootContext.getXID()
        // do business2 and rebind xid again
        RootContext.bind(xid);
        // do dubbo injvm invoke business3
    }
}

@markr512
Copy link
Author

markr512 commented Apr 9, 2024

好的 谢谢!

@Alleninggx
Copy link

apache/dubbo#14485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants