You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nodece (via GitHub)" <gi...@apache.org> on 2024/12/12 13:08:25 UTC
Re: [PR] [Issue 1276] Fix multiple consumers using zeroQueueConsumer [pulsar-client-go]
nodece commented on code in PR #1278:
URL: https://github.com/apache/pulsar-client-go/pull/1278#discussion_r1882030452
##########
pulsar/consumer_zero_queue_test.go:
##########
@@ -95,6 +95,89 @@ func TestNormalZeroQueueConsumer(t *testing.T) {
err = consumer.Unsubscribe()
assert.Nil(t, err)
}
+
+func TestMultipleConsumer(t *testing.T) {
+ client, err := NewClient(ClientOptions{
+ URL: lookupURL,
+ })
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer client.Close()
+
+ topic := newTopicName()
+ ctx := context.Background()
+
+ // create consumer1
+ consumer1, err := client.Subscribe(ConsumerOptions{
+ Topic: topic,
+ SubscriptionName: "my-sub",
+ Type: Shared,
+ EnableZeroQueueConsumer: true,
+ })
+ assert.Nil(t, err)
+ _, ok := consumer1.(*zeroQueueConsumer)
+ assert.True(t, ok)
+ defer consumer1.Close()
+
+ // create consumer2
+ consumer2, err := client.Subscribe(ConsumerOptions{
+ Topic: topic,
+ SubscriptionName: "my-sub",
+ Type: Shared,
+ EnableZeroQueueConsumer: true,
+ })
+ assert.Nil(t, err)
+ _, ok = consumer2.(*zeroQueueConsumer)
+ assert.True(t, ok)
+ defer consumer2.Close()
+
+ // create producer
+ producer, err := client.CreateProducer(ProducerOptions{
+ Topic: topic,
+ DisableBatching: false,
Review Comment:
```suggestion
DisableBatching: true,
```
Is it right?
--
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-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org