apache / pulsar-client-go

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

[fix] peek message will return -1 for partitionIndex #1267

Closed shibd closed 1 month ago

shibd commented 1 month ago

Motivation

If peek a partitioned topic, will see a message id: 7316:0:-1:-1, the parititonIndex should not be -1.

pulsarctl subscription peek --count 10 persistent://public/default/my-topic-partition-0 test-sub
Message ID : 7316:0:-1:-1
Properties :
{
    "publish-time": "2024-08-08T17:50:39.476+08:00"
}
Message :
00000000  68 65 6c 6c 6f 2d 31                              |hello-1|

Modifications

Verifying this change

Add TestPeekMessageForPartitionedTopic to cover it.

Documentation