2019-06-14 09:29:21 UTC - xiaolong.ran: `TopicsPattern` is only for the topics level and cannot be matched to the partition level. Because the partition is invisible to the user. ---- 2019-06-14 11:37:50 UTC - Bharadwaj R Embar: @xiaolong.ran I’ll make this simpler. I have one topic which is non-partitioned. I’m trying to use the same regex based subscription.
``` Producer Side: Topic: my-topic ``` ``` Consumer Side: consumerOpts := pulsar.ConsumerOptions{ TopicsPattern: "my-topic*", SubscriptionName: "my-sub", Type: pulsar.Exclusive, MessageChannel: msgChannel, SubscriptionInitPos: pulsar.Earliest, } ``` Consume logic: ``` for cm := range msgChannel { msg := cm.Message fmt.Println("Message ID: %s", msg.ID()) fmt.Println("Got Message value: %s from : %s", string(msg.Payload()), msg.Topic()) consumer.Ack(msg) } ``` Still does not consume, instead it just hangs after saying connected to broker ---- 2019-06-14 11:38:58 UTC - Bharadwaj R Embar: ``` 2019/06/14 17:08:22.622 c_client.go:68: [info] INFO | ConnectionPool:72 | Created connection for <pulsar://pulsar.stage:6650> 2019/06/14 17:08:23.239 c_client.go:68: [info] INFO | ClientConnection:300 | [xxxxxxx:57734 -> xxxxxxx:6650] Connected to broker ``` ---- 2019-06-14 11:41:26 UTC - xiaolong.ran: You can refer to this test code: <https://github.com/apache/pulsar/blob/master/pulsar-client-go/pulsar/consumer_test.go#L359-L417> ---- 2019-06-14 11:43:02 UTC - xiaolong.ran: Look at the log information, it feels like the pattern does not match the appropriate topic ---- 2019-06-14 11:44:56 UTC - xiaolong.ran: Or, can you give me a simple test code? It’s best to reproduce the problem you’re experiencing. ---- 2019-06-14 12:08:42 UTC - Bharadwaj R Embar: Big ups to @xiaolong.ran for quickly resolving the issue. I only gave the topic regex and not the fqdn of the topic , ie, `topic*` and not `<persistent://public/default/topic*>`. We need to specify the fqdn of the topics we wish to subscribe. Thanks again :slightly_smiling_face: +1 : xiaolong.ran beers : xiaolong.ran ---- 2019-06-14 12:09:13 UTC - Bharadwaj R Embar: @Shivji Kumar Jha :point_up: Works ----