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 2020/12/09 06:52:16 UTC

[GitHub] [rocketmq] djkdeveloper opened a new issue #2497: rockmq的事务消息

djkdeveloper opened a new issue #2497:
URL: https://github.com/apache/rocketmq/issues/2497


   正常流程是 
   (1) 发送消息(half消息)。
   
   (2) 服务端响应消息写入结果。
   
   (3) 根据发送结果执行本地事务(如果写入失败,此时half消息对业务不可见,本地逻辑不执行)。
   
   (4) 根据本地事务状态执行Commit或者Rollback(Commit操作生成消息索引,消息对消费者可见)
   
   我现在的场景是 在第四部  本地事务提交 但是 hafl消息我想改 因为我的哦hafl消息是依赖本地消息的 只有本地消息处理完成了才能得到完整的hafl消息


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] francisoliverlee closed issue #2497: rockmq的事务消息

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


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] jacentsao commented on issue #2497: rockmq的事务消息

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


   
   
   
   > @djkdeveloper
   > save first, then notice es, that's a good idea. i would close the issue, feel free to reopen it if you still have any question
   > 
   > try logic code like this
   > 
   > ```java
   > ProductInfo productInfo = save(productVO);//success: return product object with uniq id, fail: return null
   > if(productInfo!=null){
   >     sendMQToES(productInfo);// not transactional msg would be ok
   > }else{
   >     return "save product fail";
   > }
   > ```
   
   Message may lost 


-- 
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper removed a comment on issue #2497: rockmq的事务消息

Posted by GitBox <gi...@apache.org>.
djkdeveloper removed a comment on issue #2497:
URL: https://github.com/apache/rocketmq/issues/2497#issuecomment-742207501


   有关系啊 事务消息是相当于先发送half消息的啊 但是有可能我这个half消息里面的信息有部分是需要经过执行本地事务才知道结果的啊 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper commented on issue #2497: rockmq的事务消息

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


   > what's your prolem exactly
   
   新增商品后通知es服务 进行商品索引
   按照rocketmq的流程
   
   发送消息给mq
   mq回调 商品服务器执行本地事务(新增商品和商品的一些关联信息)
   3.mq 发送half消息给 es服务进行索引
   问题在:
   第一步发送给mq的时候商品的部分数据是拿不到的比如 商品的id
   导致发送给mq的half消息里面的商品信息是不完整的商品信息


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper commented on issue #2497: rockmq的事务消息

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


   新增商品后通知es服务 进行商品索引
   按照rocketmq的流程
   1. 发送消息给mq  
   2. mq回调  商品服务器执行本地事务(新增商品和商品的一些关联信息)
   3.mq 发送half消息给 es服务进行索引 
   
   问题在:
   第一步发送给mq的时候商品的部分数据是拿不到的比如 商品的id
   导致发送给mq的half消息里面的商品信息是不完整的商品信息


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper commented on issue #2497: rockmq的事务消息

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


   > > > 怎么感觉这个和事务消息没多大关系呢 哈哈
   > > 
   > > 
   > > 有关系啊 事务消息是相当于先发送half消息的啊 但是有可能我这个half消息里面的信息有部分是需要经过执行本地事务才知道结果的啊
   > 
   > 我的意思是能不能先执行商品存储,然后就能得到商品的完整信息(包括商品ID),再把该消息发送到MQ,然后ES进行消费建立索引。相当于这个场景就不太适用发送事务消息,是不是发送一般的消息就行了
   
   恩 这也是我最后没办法的方。。。。我也只是好奇 如果真是遇到我那种必须要确保同一个事务的场景怎么办 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] francisoliverlee commented on issue #2497: rockmq的事务消息

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


   what's your prolem exactly


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] francisoliverlee commented on issue #2497: rockmq的事务消息

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


   @djkdeveloper 
   save first, then notice es, that's a good idea. i would close the issue, feel free to reopen it if you still have any question
   
   try logic code like this  
   ```java
   ProductInfo productInfo = save(productVO);//success: return product object with uniq id, fail: return null
   if(productInfo!=null){
       sendMQToES(productInfo);// not transactional msg would be ok
   }else{
       return "save product fail";
   }
   ```
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper edited a comment on issue #2497: rockmq的事务消息

Posted by GitBox <gi...@apache.org>.
djkdeveloper edited a comment on issue #2497:
URL: https://github.com/apache/rocketmq/issues/2497#issuecomment-742210235


   > > > 怎么感觉这个和事务消息没多大关系呢 哈哈
   > > 
   > > 
   > > 有关系啊 事务消息是相当于先发送half消息的啊 但是有可能我这个half消息里面的信息有部分是需要经过执行本地事务才知道结果的啊
   > 
   > 我的意思是能不能先执行商品存储,然后就能得到商品的完整信息(包括商品ID),再把该消息发送到MQ,然后ES进行消费建立索引。相当于这个场景就不太适用发送事务消息,是不是发送一般的消息就行了
   
   恩 这也是我最后没办法的方。。。。我也只是好奇 如果真是遇到我那种必须要确保同一个事务的场景怎么办 ,如果用传统的方式我会自己记录日志 把日志和本地执行后的结果 记录到一起然后通过定时任务把日志里面的消息发出去 给mq 但是用这个mq的事务消息模式 不知道怎么办


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] jacentsao commented on issue #2497: rockmq的事务消息

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


   
   
   
   > @djkdeveloper
   > save first, then notice es, that's a good idea. i would close the issue, feel free to reopen it if you still have any question
   > 
   > try logic code like this
   > 
   > ```java
   > ProductInfo productInfo = save(productVO);//success: return product object with uniq id, fail: return null
   > if(productInfo!=null){
   >     sendMQToES(productInfo);// not transactional msg would be ok
   > }else{
   >     return "save product fail";
   > }
   > ```
   
   Message may lost 


-- 
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper commented on issue #2497: rockmq的事务消息

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


   > 怎么感觉这个和事务消息没多大关系呢 哈哈
   
   有关系啊 事务消息是相当于先发送half消息的啊 但是有可能我这个half消息里面的信息有部分是需要经过执行本地事务才知道结果的啊 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] mgljava commented on issue #2497: rockmq的事务消息

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


   > > 怎么感觉这个和事务消息没多大关系呢 哈哈
   > 
   > 有关系啊 事务消息是相当于先发送half消息的啊 但是有可能我这个half消息里面的信息有部分是需要经过执行本地事务才知道结果的啊
   
   我的意思是能不能先执行商品存储,然后就能得到商品的完整信息(包括商品ID),再把该消息发送到MQ,然后ES进行消费建立索引。相当于这个场景就不太适用发送事务消息,是不是发送一般的消息就行了


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] mgljava commented on issue #2497: rockmq的事务消息

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


   怎么感觉这个和事务消息没多大关系呢 哈哈


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] djkdeveloper commented on issue #2497: rockmq的事务消息

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


   有关系啊 事务消息是相当于先发送half消息的啊 但是有可能我这个half消息里面的信息有部分是需要经过执行本地事务才知道结果的啊 


----------------------------------------------------------------
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:
users@infra.apache.org