You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/12/07 04:47:47 UTC

[GitHub] [rocketmq-client-go] stelth2016 opened a new issue, #968: use rocketmq-go-client send msg with Compress==true caught search msg return NullPointErr Exception by origin tool

stelth2016 opened a new issue, #968:
URL: https://github.com/apache/rocketmq-client-go/issues/968

   SDK version: github.com/apache/rocketmq-client-go/v2
   
   my test code:
   ```
   				for i := 0; i < userconf.MsgNum; i++ {
   					t := time.Now().Format("2006-01-02 15:04:05")
   					msg := &primitive.Message{
   						Topic: topic,
   						Body:  []byte("RocketMQ Go Client Message: " + strconv.Itoa(i) + " sending  time:" + t),
   					}
   					msg.Compress =true
                                  res, err := p.SendSync(context.Background(), msg)
   					if err != nil {
   						fmt.Printf("batch send producer_sync message error:%s\n", err)
   					} else {
   						fmt.Printf("batch send producer_sync message success. result=%s,msg=%s\n", res.String(), 
                                        string(msg.Body))
   					}
   ```
   when I send msg ,sdk didn't return any error ; buy when I use mqadmin query msg by MsgID, it return  NullPointErr Exception ;
   I check the sdk code, found that in rocketmq-client-go/v2/producer/producer.go:
   ```
   func (p *defaultProducer) tryCompressMsg(msg *primitive.Message) bool {
   	if msg.Compress {
   		return true
   	}
   	if msg.Batch {
   		return false
   	}
   	if len(msg.Body) < p.options.CompressMsgBodyOverHowmuch {
   		return false
   	}
   	compressedBody, e := utils.Compress(msg.Body, p.options.CompressLevel)
   	if e != nil {
   		return false
   	}
   	msg.CompressedBody = compressedBody
   	msg.Compress = true
   	return true
   
   }
   ```
   when msg.Compress == true ,it just returns, BUT msg.CompressedBody  IS NULL THIS MOUMEMT !  IS THIS THE PROBLEM ?
   


-- 
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: commits-unsubscribe@rocketmq.apache.org.apache.org

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