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/29 02:53:11 UTC

[GitHub] [rocketmq-client-go] jwrookie opened a new issue #746: repeated consumption caused by retry

jwrookie opened a new issue #746:
URL: https://github.com/apache/rocketmq-client-go/issues/746


   测试场景:
   ● 一个生产者,生产5条消息,默认4个队列
   ● 3个消费者
   
   消费者:
   `
   package main
   
   import (
   	"context"
   	"fmt"
   	"os"
   	"time"
   
   	"github.com/apache/rocketmq-client-go/v2"
   	"github.com/apache/rocketmq-client-go/v2/consumer"
   	"github.com/apache/rocketmq-client-go/v2/primitive"
   )
   
   func main() {
   	c, _ := rocketmq.NewPushConsumer(
   		consumer.WithGroupName("testGroup007"),
   		consumer.WithNsResolver(primitive.NewPassthroughResolver([]string{"172.17.0.6:9876"})),
   		consumer.WithConsumeMessageBatchMaxSize(1),
   	)
   	err := c.Subscribe("test007", consumer.MessageSelector{}, func(ctx context.Context,
   		msgs ...*primitive.MessageExt) (consumer.ConsumeResult, error) {
   		fmt.Println(len(msgs))
   		for i := range msgs {
   			fmt.Printf("subscribe callback: %v \n", msgs[i])
   		}
   		fmt.Println("---------------------------------")
   		time.Sleep(time.Second * 1)
   
   		return consumer.ConsumeRetryLater, nil
   	})
   	if err != nil {
   		fmt.Println(err.Error())
   	}
   	// Note: start after subscribe
   	err = c.Start()
   	if err != nil {
   		fmt.Println(err.Error())
   		os.Exit(-1)
   	}
   	time.Sleep(time.Hour)
   	err = c.Shutdown()
   	if err != nil {
   		fmt.Printf("shutdown Consumer error: %s", err.Error())
   	}
   }
   `
   
   结果:发现重试队列有非常多重复的数据
   ![image](https://user-images.githubusercontent.com/41732283/143801326-e1ac2ba8-048e-4500-b492-1a267d7085a0.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-client-go] jwrookie commented on issue #746: repeated consumption caused by retry

Posted by GitBox <gi...@apache.org>.
jwrookie commented on issue #746:
URL: https://github.com/apache/rocketmq-client-go/issues/746#issuecomment-984320878


   > 
   这会导致消费者拿到重复的记录


-- 
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-client-go] vongosling closed issue #746: repeated consumption caused by retry

Posted by GitBox <gi...@apache.org>.
vongosling closed issue #746:
URL: https://github.com/apache/rocketmq-client-go/issues/746


   


-- 
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-client-go] maixiaohai commented on issue #746: repeated consumption caused by retry

Posted by GitBox <gi...@apache.org>.
maixiaohai commented on issue #746:
URL: https://github.com/apache/rocketmq-client-go/issues/746#issuecomment-984292512


   If a message can not be conumsed success, it will resend to retry topic base on the retry strategy.


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