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 2022/04/30 14:10:57 UTC

[GitHub] [rocketmq] 903296615 opened a new issue, #4227: 这个TransactionListenerImpl设置localTrans.put(msg.getTransactionId(), status)不是很理解

903296615 opened a new issue, #4227:
URL: https://github.com/apache/rocketmq/issues/4227

   [rocketmq](https://github.com/apache/rocketmq)/example/src/main/java/org/apache/rocketmq/[example](https://github.com/apache/rocketmq/tree/develop/example)/transaction/TransactionListenerImpl.java /
   
   你好,我看这个代码有个不明白的地方
   
   这个设置localTrans.put(msg.getTransactionId(), status);
   1.没有清除方法吗?
   2.会有泄露风险吗?
   3这个随机值的意义是什么.三分之一成功吗?
   4多个消费者启动的时候,这个checkLocalTransaction方法可能会被其他消费者执行,并不是发送的执行,导致进入default,这个好像没什么作用.


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

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


[GitHub] [rocketmq] duhenglucky closed issue #4227: 这个TransactionListenerImpl设置localTrans.put(msg.getTransactionId(), status)不是很理解

Posted by GitBox <gi...@apache.org>.
duhenglucky closed issue #4227: 这个TransactionListenerImpl设置localTrans.put(msg.getTransactionId(), status)不是很理解
URL: https://github.com/apache/rocketmq/issues/4227


-- 
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] 903296615 commented on issue #4227: 这个TransactionListenerImpl设置localTrans.put(msg.getTransactionId(), status)不是很理解

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

   好的,谢谢


-- 
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] MatrixHB commented on issue #4227: 这个TransactionListenerImpl设置localTrans.put(msg.getTransactionId(), status)不是很理解

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

   这里只是给出一个事务消息的使用示例,真正的executeLocalTransaction() 方法的实现逻辑,应该是客户端需要自行实现的本地事务(比如数据写入DB)。这里的`localTrans.put(msg.getTransactionId(), status)`; 只是示范了客户端可以自行维护一个保存事务状态的ConcurrentHashMap,便于回查,实际上回查`checkLocalTransaction`也可以直接去查本地事务的执行结果(比如检查DB)
   如何清除localTrans,防止内存泄漏,由客户端自行实现,例如map使用有缓存时间的cache、回查时查询不到则查DB,例如回查完成后进行清除。
   随机给1/3成功只是个example。
   
   
   


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