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/05/04 13:24:03 UTC

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

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