Skip to content

Commit 7f7fb43

Browse files
authored
ZeroQueueConsumer is not supported with RetryEnable (#1391)
1 parent 67c3d53 commit 7f7fb43

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

pulsar/consumer_impl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ type consumer struct {
7474
}
7575

7676
func newConsumer(client *client, options ConsumerOptions) (Consumer, error) {
77+
78+
if options.RetryEnable && options.EnableZeroQueueConsumer {
79+
return nil, newError(InvalidConfiguration, "ZeroQueueConsumer is not supported with RetryEnable")
80+
}
81+
7782
if options.Topic == "" && options.Topics == nil && options.TopicsPattern == "" {
7883
return nil, newError(TopicNotFound, "topic is required")
7984
}

pulsar/consumer_zero_queue_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,26 @@ import (
3131
"github.com/stretchr/testify/assert"
3232
)
3333

34+
func TestRetryEnableZeroQueueConsumer(t *testing.T) {
35+
client, err := NewClient(ClientOptions{
36+
URL: lookupURL,
37+
})
38+
39+
assert.Nil(t, err)
40+
defer client.Close()
41+
42+
topic := newTopicName()
43+
44+
// create consumer
45+
_, err = client.Subscribe(ConsumerOptions{
46+
Topic: topic,
47+
SubscriptionName: "my-sub",
48+
RetryEnable: true,
49+
EnableZeroQueueConsumer: true,
50+
})
51+
assert.ErrorContains(t, err, "ZeroQueueConsumer is not supported with RetryEnable")
52+
}
53+
3454
func TestNormalZeroQueueConsumer(t *testing.T) {
3555
client, err := NewClient(ClientOptions{
3656
URL: lookupURL,

0 commit comments

Comments
 (0)