IMO, exposing the ledger id and entry id directly through the API is
not a good idea. For example, what if you want to get a chunked
message? You would have to add another field again and deprecate the
existing method.

I think we should just accept a string like
"bk:ledger:entry:batch_index" that represents a MessageID instead. If
we're going to replace BK with other storage systems in future (though
I think it's far way from now), we can still reuse this API.

Thanks,
Yunze

On Thu, Dec 28, 2023 at 5:21 PM Zixuan Liu <zix...@apache.org> wrote:
>
> Hi Pulsar Community,
>
> I want to discuss the return value of the
> `org.apache.pulsar.client.admin.Topics#getMessageById`, which returns
> `Message<byte[]>`. If the message is a batch message, we only get the first
> message from the batch message.
>
> So I want to change this behavior by returning `List<Message<byte[]>`, and
> in the CLI, we also need to print multiple messages when using
> `get-message-by-id`.
>
> Now, I am adding a new method with the same name and a `batchIndex`
> parameter. When "batchIndex" is -1, we can retrieve all messages from the
> batch message. Otherwise, we get one message by giving the index. For this
> implementation, please see  https://github.com/apache/pulsar/pull/21813.
>
> In long time ago, there was also a PR to fix this issue, please see
> https://github.com/apache/pulsar/pull/19827.
>
> Two PR uses different ways to fix this issue, please let me know your
> thoughts!
>
> Thanks,
> Zixuan

Reply via email to