This is an automated email from the ASF dual-hosted git repository.
zixuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new b25d2c38fbd [improve][pip] PIP-330: getMessagesById gets all messages
(#21873)
b25d2c38fbd is described below
commit b25d2c38fbd7960fd7ef6bbe13ea3fff1a4edeb1
Author: Zixuan Liu <[email protected]>
AuthorDate: Thu Jan 18 12:13:36 2024 +0800
[improve][pip] PIP-330: getMessagesById gets all messages (#21873)
Signed-off-by: Zixuan Liu <[email protected]>
---
pip/pip-330.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/pip/pip-330.md b/pip/pip-330.md
new file mode 100644
index 00000000000..80329402643
--- /dev/null
+++ b/pip/pip-330.md
@@ -0,0 +1,54 @@
+# PIP-330: getMessagesById gets all messages
+
+# Motivation
+
+The `org.apache.pulsar.client.admin.Topics` provides
`getMessageById(java.lang.String, long, long)` method to get the
+message, which returns one message. If the message id refers to a batch
message, we can only get the first message, not
+all messages.
+
+This behavior affects our analysis of messages by the message id.
+
+# Goals
+
+## In Scope
+
+Add a method that returns all messages by message id to the
`org.apache.pulsar.client.admin.Topics` interface.
+
+# Detailed Design
+
+## Design & Implementation Details
+
+1. Add a set of methods to the `org.apache.pulsar.client.admin.Topics`
interface:
+
+```java
+public interface Topics {
+ List<Message<byte[]>> getMessagesById(String topic, long ledgerId, long
entryId) throws PulsarAdminException;
+ CompletableFuture<List<Message<byte[]>>> getMessagesByIdAsync(String
topic, long ledgerId, long entryId);
+}
+```
+
+2. Deprecate the following methods in the
`org.apache.pulsar.client.admin.Topics` interface:
+```java
+public interface Topics {
+ /**
+ * @deprecated Use {@link #getMessagesById(String, long, long)} instead.
+ */
+ @Deprecated
+ Message<byte[]> getMessageById(String topic, long ledgerId, long entryId)
throws PulsarAdminException;
+
+ /**
+ * @deprecated Use {@link #getMessagesByIdAsync(String, long, long)}
instead.
+ */
+ @Deprecated
+ CompletableFuture<Message<byte[]>> getMessageByIdAsync(String topic, long
ledgerId, long entryId);
+}
+```
+
+# General Notes
+
+This PIP doesn't change the output of `bin/pulsar-admin topics
get-message-by-id`, which still outputs one message.
+
+# Links
+
+* Mailing List discussion thread:
https://lists.apache.org/thread/vqyh3mvtvovd383sd8zxnlzsspdr863z
+* Mailing List voting thread:
https://lists.apache.org/thread/n1f91v46tct6o5o72pd53hcyvr9xx9qr