willis-yang opened a new issue, #1133:
URL: https://github.com/apache/rocketmq-client-go/issues/1133

   `    rlog.SetOutputPath("./logs/rocketmq-client-go.log")
   
        nameserverReslover := 
primitive.NewPassthroughResolver([]string{Endpoint})
   
        //traceCfg := &primitive.TraceConfig{
        //      Access:   primitive.Cloud,
        //      Resolver: nameserverReslover,
        //}
        c, err := rocketmq.NewPushConsumer(
   
                consumer.WithGroupName(ConsumerGroup),
   
                consumer.WithNsResolver(nameserverReslover),
   
                consumer.WithCredentials(primitive.Credentials{
                        SecretKey: SecretKey,
                        AccessKey: AccessKey,
                }),
                consumer.WithConsumerModel(consumer.BroadCasting),
   
                consumer.WithNamespace(""),
   
                //consumer.WithTrace(traceCfg),
        )
        if err != nil {
                fmt.Println("init consumer error: " + err.Error())
                os.Exit(0)
        }
   
        err = c.Subscribe(Topic, consumer.MessageSelector{
                Type:       consumer.TAG,
                Expression: "*",
        }, func(ctx context.Context,
                msgs ...*primitive.MessageExt) (consumer.ConsumeResult, error) {
                fmt.Printf("subscribe callback: %v \n", msgs)
                return consumer.ConsumeSuccess, nil
        })
        if err != nil {
                fmt.Printf("subscribe callback error: %v", err)
        }
   
        err = c.Start()
        if err != nil {
                fmt.Printf("start Consumer error:%v", err.Error())
                os.Exit(-1)
        }
        time.Sleep(time.Hour)
        err = c.Shutdown()
        if err != nil {
                fmt.Printf("Shutdown Consumer error: %s", err)
        }`


-- 
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-unsubscr...@rocketmq.apache.org.apache.org

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

Reply via email to