2259289435 commented on issue #1838: New Programming Model of 
TransactionMQProducer
URL: https://github.com/apache/rocketmq/issues/1838#issuecomment-598066085
 
 
   
请教下你怎么设计的,现在发送后立马就会触发回调,但此时本地数据库事务其实还没有提交,我是通过修改源码,把发送完触发回调的逻辑干掉了,然后开放了手工提交和手工回滚的接口出来,通过spring的事务回调来手工提交和回滚,然后另外一个回调是用来兜底判断,那个没问题,因为手工提交和回滚都是oneway的,有可能不成功。
   
   
   
   [email protected]
    
   From: liujian16
   Date: 2020-03-12 16:08
   To: apache/rocketmq
   CC: Subscribed
   Subject: [apache/rocketmq] New Programming Model of TransactionMQProducer 
(#1838)
   Under 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 extract 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.
   —
   You are receiving this because you are subscribed to this thread.
   Reply to this email directly, view it on GitHub, or unsubscribe.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to