streamnative / pulsar-client-go

Apache Pulsar Go Client Library
https://pulsar.apache.org/
Apache License 2.0
1 stars 2 forks source link

ISSUE-553: [Reader] The topic not found when create reader with listener name #237

Open sijie opened 3 years ago

sijie commented 3 years ago

Original Issue: apache/pulsar-client-go#553


Describe the bug A clear and concise description of what the bug is.

To Reproduce

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/apache/pulsar-client-go/pulsar"
)

func main() {
    client, err := pulsar.NewClient(pulsar.ClientOptions{
        URL:            "pulsar://localhost:6000",
        ListenerName:   "custom:xxxx/vpc-xxxxxx/subnet-xxxxxx",
        Authentication: pulsar.NewAuthenticationToken("eyJrZxxxxxxxxxxx"),
    })
    if err != nil {
        log.Fatal(err)
    }

    defer client.Close()

    reader, err := client.CreateReader(pulsar.ReaderOptions{
        Topic:          "persistent://test-tenant/test-ns/test-topic",
        StartMessageID: pulsar.EarliestMessageID(),
    })
    if err != nil {
        log.Fatal(err)
    }
    defer reader.Close()

    for reader.HasNext() {
        msg, err := reader.Next(context.Background())
        if err != nil {
            log.Fatal(err)
        }

        fmt.Printf("Received message msgId: %#v -- content: '%s'\n",
            msg.ID(), string(msg.Payload()))
    }
}

Expected behavior We can create the reader successfully

Screenshots

bdcb83d8-758d-4545-91f8-3ba1ac7685a7

Desktop (please complete the following information):


But this topic already exists, it is normal to use producer or consumer