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

feature : RocketMQ transaction are supported #6230

Merged
merged 59 commits into from
Mar 3, 2024

Conversation

Bughue
Copy link
Contributor

@Bughue Bughue commented Jan 2, 2024

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

集成rocketmq到seata。

关于总体解决思路:

本次集成的能力重点在全局事务的一阶段,我们会提供一个SeataMQProducer,在里面将以下两个方法自动加入到全局事务中。其他方法会调用到原生父类进行,不会加入到全局事务。

关于具体实现方案及时序:

程序流程:

  1. rocketmq按发送半消息(和rocketmq原有逻辑一样)
  2. 执行本地事务executeLocalTransaction/executeLocalTransactionBranch(和rocketmq原有逻辑一样)
  3. 如果state=成功,强行改回unknown,等待seata-TC调用rm决定二阶段。否则都将直接rollback这个消息(因为seata目前无法支持rm一阶段回查能力)

测试相关

目前没有单测,在本地已经测试过了

Overall Solution Approach:

This integration focuses on the initial phase of global transactions. We will provide a SeataMQProducer, which will automatically incorporate the following two methods into the global transaction. Other methods will invoke the native superclass and will not be included in the global transaction.

Specific Implementation Plan and Sequence:

Use the existing InterfaceParser proxy mechanism to proxy the TransactionMQProducer type bean and override sendMessageInTransaction.
Program flow:

  1. RocketMQ sends a half message (as per RocketMQ's original logic).
  2. Execute the local transaction executeLocalTransaction/executeLocalTransactionBranch (as per RocketMQ's original logic).
  3. If state=success, forcibly change it back to unknown, and wait for Seata-TC to call RM to decide on the second phase. Otherwise, directly roll back this message (as Seata currently lacks the capability to support RM phase one re-check).

Test

There is no unittest currently, it has been tested locally

Ⅱ. Does this pull request fix one issue?

fixes #3752

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@Bughue
Copy link
Contributor Author

Bughue commented Jan 18, 2024

老pr #3974

@Bughue Bughue changed the title feature : Integrate RocketMQ into Seata [WIP]feature : Integrate RocketMQ into Seata Jan 24, 2024
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.branchtype=tcc
2.代理send 而不是半消息
3.独立producer,和独立的listener
4.回查看看能否使用queryxidrequest,直接查看xid对应事务的状态做二阶段半消息的提交/回滚
5.如果回查时xid不存在,代表这个事务已经回滚完成,直接回滚即可
6.回滚时如果没有半消息的msgid,直接代表分支已经回滚完成,因为消息会按照第五点进行自动回滚
7.多个producer对应多个rocketmq集群时,目前暂不支持.

@Bughue Bughue changed the title [WIP]feature : Integrate RocketMQ into Seata feature : Integrate RocketMQ into Seata Jan 26, 2024
Bughue added 13 commits January 26, 2024 10:33
# Conflicts:
#	all/pom.xml
#	rm/src/main/java/org/apache/seata/rm/DefaultResourceManager.java
#	seata-spring-autoconfigure/seata-spring-autoconfigure-client/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/client/RocketMQProperties.java
#	seata-spring-boot-starter/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataRocketMQAutoConfiguration.java
@Bughue Bughue closed this Feb 1, 2024
@Bughue Bughue reopened this Feb 1, 2024
@Bughue Bughue closed this Feb 28, 2024
@Bughue Bughue reopened this Feb 28, 2024
@funky-eyes funky-eyes changed the title feature : Integrate RocketMQ into Seata feature : RocketMQ transaction are supported Mar 3, 2024
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes added the module/test test module label Mar 3, 2024
@funky-eyes funky-eyes merged commit 7ce96e4 into apache:2.x Mar 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/test test module multilingual type: feature Category issues or prs related to feature request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Summer2021] Integrate RocketMQ into Seata
4 participants