wolfstudy opened a new issue #554:
URL: https://github.com/apache/pulsar-client-go/issues/554


   **Describe the bug**
   
   ```
   Code: 403, Reason: {"reason":"Unauthorized to validateNamespaceOperation for 
operation [GET_TOPICS] on namespace [pulsar-8j7gam3dx58n/default]"}
   ```
   
   
   **Screenshots**
   
   
![企业微信截图_1da1205e-82c5-4608-b6c8-ff4f50d1d571](https://user-images.githubusercontent.com/20965307/123574650-d4673580-d802-11eb-8a00-17cc23e626d7.png)
   
   
   **Desktop (please complete the following information):**
    - OS: Mac OS
    - Go version: master
   
   
   ---
   
   It is normal to use Topic and Topics, and the demo of TopicsPattern as 
follows:
   
   ```
   package main
   
   import (
        "context"
        "fmt"
        "log"
        "time"
   
        "github.com/apache/pulsar-client-go/pulsar"
   )
   
   func main() {
   
        client, err := pulsar.NewClient(pulsar.ClientOptions{
                URL:               "http://localhost:8080";,                     
                                                                                
                  
                Authentication:    
pulsar.NewAuthenticationToken("eyJrZxxxxxx"), 
                OperationTimeout:  30 * time.Second,
                ConnectionTimeout: 30 * time.Second,
        })
        if err != nil {
                log.Fatalf("Could not instantiate Pulsar client: %v", err)
        }
   
        defer client.Close()
   
        consumer, err := client.Subscribe(pulsar.ConsumerOptions{
                //Topic: "pulsar-xxxxx/default/muzhao-test-queue", 
                //Topics: []string{"pulsar-xxxxx/default/micro-email-send"},
                TopicsPattern: "pulsar-xxxxx/default/.*",
                SubscriptionName: "muzhao-test-queue",
                Type:             pulsar.Shared,
        })
        if err != nil {
                log.Fatal(err)
        }
        defer consumer.Close()
   
        for i := 0; i < 10; i++ {
                msg, err := consumer.Receive(context.Background())
                if err != nil {
                        log.Fatal(err)
                }
   
                fmt.Printf("Received message--------------- msgId: %#v -- 
content: '%s'\n",
                        msg.ID(), string(msg.Payload()))
   
                consumer.Ack(msg)
        }
   
        if err := consumer.Unsubscribe(); err != nil {
                log.Fatal(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...@pulsar.apache.org

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


Reply via email to