New Programming Model of TransactionMQProducer
See original GitHub issueUnder current design, LocalTransaction is executed after half message is successfully sent. A LocalTransaction may takes long time to complete, and while it is running , TransactionCheckerListener may be called to report the status of the transaction. It’s very hard or even impossible for the TransactionCheckerListener to distinguish whether the transaction is on-going or is rollbacked.
I’d propose a new programming model of TransactionMQProducer.
- Start local transaction
- Execute local transaction logic
- Call TransactionMQProducer to send half message and record
SendResult
- Commit or Rollback local transaction based on SendResult.
- Tell MQ the local transaction state.
According to this design, there is no extra work to do after half message is sent, TransactionCheckerListener can be confident the transaction is rollbacked if it can find a record in the database. And Step 5 can be easily implemented using Spring Transaction bound event.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Enabling Message Tracing - 华为云
Set enableMsgTrace of the constructor to true. For example: TransactionMQProducer producer = new TransactionMQProducer(null, "ProducerGroupName" ...
Read more >com.alibaba.rocketmq.client.producer.TransactionMQProducer.start ...
This exception is thrown when a program attempts to create an URL from an incorrect specification. URLConnection (java.net). A connection to a URL...
Read more >org.apache.rocketmq.client.exception.MQClientException
This page shows Java code examples of org.apache.rocketmq.client.exception.MQClientException.
Read more >Use _local_execute in fMBT With Examples | LambdaTest
Learn how to use _local_execute function in fMBT framework for your next python automation project with LambdaTest Automation Testing Advisor.
Read more >Diff - rocketmq-client-python - Google Git
diff --git a/.coveragerc b/.coveragerc new file mode 100644 index ... _handle)) + + +class TransactionMQProducer(Producer): + def __init__(self, group_id, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://github.com/openmessaging/openmessaging-java/blob/master/openmessaging-api/src/main/java/io/openmessaging/producer/Producer.java The API shown below is provided in OpenMessaging, any comments are welcome: )
I didn’t find the prepare method implementation in the code https://github.com/apache/rocketmq/blob/master/openmessaging/src/main/java/io/openmessaging/rocketmq/producer/ProducerImpl.java, rocketmq have implemented this? i implement a demo with spring transaction manager like ` @Slf4j public class TransactionProducer {
} `