Skip to content

Commit 21682ac

Browse files
authored
fix: create non-partitions topic (streamnative#577)
Signed-off-by: Zixuan Liu <[email protected]>
1 parent ed7f745 commit 21682ac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/pulsar/topic.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,13 @@ func (c *pulsarClient) Topics() Topics {
250250

251251
func (t *topics) Create(topic utils.TopicName, partitions int) error {
252252
endpoint := t.pulsar.endpoint(t.basePath, topic.GetRestPath(), "partitions")
253+
data := &partitions
253254
if partitions == 0 {
254255
endpoint = t.pulsar.endpoint(t.basePath, topic.GetRestPath())
256+
data = nil
255257
}
256-
return t.pulsar.Client.Put(endpoint, partitions)
258+
259+
return t.pulsar.Client.Put(endpoint, data)
257260
}
258261

259262
func (t *topics) Delete(topic utils.TopicName, force bool, nonPartitioned bool) error {

0 commit comments

Comments
 (0)