You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/11/18 03:25:39 UTC

[GitHub] [rocketmq] yedf3 opened a new issue #3500: 事务消息能够快速提交吗?

yedf3 opened a new issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500


   有没有事务消息的官方例子?没有找到事务消息的官方例子,谷歌搜出来的靠前的例子为这个:https://segmentfault.com/a/1190000039868496
   这个例子的流程如下:
   1. 开启本地事务
   2. 发送Prepare消息
   3.  执行Prepare成功后本地事务,返回UNKNOWN
   4. RocketMq回查时,返回COMMIT,最后发送消息
   
   在这个流程中,3执行完之后,最好是要直接发送Commit到RocketMQ,如果走4的话,就会导致6秒超时回查,过了这6秒,业务才被调用,才达到最终一致。业务讨论时反馈没有异常发生也要等待这个6秒太长了


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] Git-Yang commented on issue #3500: 事务消息能够快速提交吗?

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500#issuecomment-972490289


   结合自己业务实际情况处理,如果本地事务执行完后确认ok可以直接返回commit。


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yedf3 commented on issue #3500: 事务消息能够快速提交吗?

Posted by GitBox <gi...@apache.org>.
yedf3 commented on issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500#issuecomment-972488724


   <img width="755" alt="image" src="https://user-images.githubusercontent.com/88143584/142347013-3fcb23e7-5884-421e-a791-21039363402a.png">
   
   这个地方其实是文章作者理解不对吗?还是说作者说的这种情况可能发生?


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yedf3 closed issue #3500: 事务消息能够快速提交吗?

Posted by GitBox <gi...@apache.org>.
yedf3 closed issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500


   


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yedf3 commented on issue #3500: 事务消息能够快速提交吗?

Posted by GitBox <gi...@apache.org>.
yedf3 commented on issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500#issuecomment-972498436


   大概了解了。其实是文章作者的例子,在业务成功时,返回COMMIT更好。因为RocketMQ是在提交完本地事务之后,再发送COMMIT消息。
   - 在提交本地事务之前掉电,那么COMMIT没有发送,后续走回查,会最终回滚
   - 在提交本地事务之后掉电,发送COMMIT之前掉电,那么后续走回查,会最终返回COMMIT
   - 没有掉电,那么发送COMMIT消息,很快让业务达到最终一致
   
   官方例子中返回UNKNOWN不是标准做法,仅仅是为了演示一遍回查的逻辑流程


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] Git-Yang commented on issue #3500: 事务消息能够快速提交吗?

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500#issuecomment-972487793


   可以在第3步执行完成本地事务直接返回COMMIT


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] Git-Yang commented on issue #3500: 事务消息能够快速提交吗?

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3500:
URL: https://github.com/apache/rocketmq/issues/3500#issuecomment-972488475


   事务消息官方用例:https://github.com/apache/rocketmq/tree/master/example/src/main/java/org/apache/rocketmq/example/transaction


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org