You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "liangyepianzhou (via GitHub)" <gi...@apache.org> on 2023/08/23 08:32:56 UTC

[GitHub] [pulsar] liangyepianzhou opened a new pull request, #21052: [feat][pip] Implement getLastMessageIds API for Reader

liangyepianzhou opened a new pull request, #21052:
URL: https://github.com/apache/pulsar/pull/21052

   ### Motivation
   
   Adding the `getLastMessageIds` Interface to Reader.
   
   Benefits:
   **Message Tracing and Recovery:**
   In certain scenarios, applications might want to continue consuming from where they left off instead of starting from the beginning. By utilizing the `getLastMessageIds` method, applications can retrieve the list of IDs for the last messages consumed in the previous session. These IDs can then be used during a restart to locate the starting position for consumption.
   
   **Troubleshooting and Analysis:**
   When a reader encounters issues, inspecting the list of IDs for messages already consumed can help determine the last position the reader has reached. This aids in troubleshooting and resolving problems.
   ### Modifications
   
   Implement getLastMessageIds API for Reader 
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #21052: [improve][pip] Implement getLastMessageIds API for Reader

Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #21052:
URL: https://github.com/apache/pulsar/pull/21052#discussion_r1303726145


##########
pip/pip-296.md:
##########
@@ -0,0 +1,100 @@
+# Background knowledge
+A consumer is a process that attaches to a topic via a subscription and then receives messages. The reader interface for Pulsar enables applications to manually manage cursors. More knowledge of the Reader and Consumer interface can be found in the [Pulsar Client doc](https://pulsar.apache.org/docs/next/concepts-clients/#reader).
+
+# Motivation
+
+Add the `getLastMessageIds` API for Reader.
+
+It can be used in the following case:
+**Message Tracing and Recovery:**
+In specific scenarios, applications might want to continue consuming from where they left off instead of starting from the beginning. Using the `getLastMessageIds` method, applications can retrieve the list of IDs for the last messages consumed in the previous session. These IDs can then be used during a restart to locate the starting position for consumption.
+
+**Troubleshooting and Analysis:**
+When a reader encounters issues, inspecting the list of IDs for messages already consumed can help determine the last position the reader has reached. This aids in troubleshooting and resolving problems.

Review Comment:
   Maybe `hasMessageAvailable` is helpful for this case?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #21052: [feat][pip] Implement getLastMessageIds API for Reader

Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #21052:
URL: https://github.com/apache/pulsar/pull/21052#discussion_r1303723374


##########
pip/pip-296.md:
##########
@@ -0,0 +1,100 @@
+# Background knowledge
+A consumer is a process that attaches to a topic via a subscription and then receives messages. The reader interface for Pulsar enables applications to manually manage cursors. More knowledge of the Reader and Consumer interface can be found in the [Pulsar Client doc](https://pulsar.apache.org/docs/next/concepts-clients/#reader).
+
+# Motivation
+
+Add the `getLastMessageIds` API for Reader.
+
+It can be used in the following case:
+**Message Tracing and Recovery:**
+In specific scenarios, applications might want to continue consuming from where they left off instead of starting from the beginning. Using the `getLastMessageIds` method, applications can retrieve the list of IDs for the last messages consumed in the previous session. These IDs can then be used during a restart to locate the starting position for consumption.

Review Comment:
   Could you explain how do you use `getLastMessageIds` to get the last messages consumed in the previous session?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] poorbarcode commented on a diff in pull request #21052: [improve][pip] Implement getLastMessageIds API for Reader

Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #21052:
URL: https://github.com/apache/pulsar/pull/21052#discussion_r1303726145


##########
pip/pip-296.md:
##########
@@ -0,0 +1,100 @@
+# Background knowledge
+A consumer is a process that attaches to a topic via a subscription and then receives messages. The reader interface for Pulsar enables applications to manually manage cursors. More knowledge of the Reader and Consumer interface can be found in the [Pulsar Client doc](https://pulsar.apache.org/docs/next/concepts-clients/#reader).
+
+# Motivation
+
+Add the `getLastMessageIds` API for Reader.
+
+It can be used in the following case:
+**Message Tracing and Recovery:**
+In specific scenarios, applications might want to continue consuming from where they left off instead of starting from the beginning. Using the `getLastMessageIds` method, applications can retrieve the list of IDs for the last messages consumed in the previous session. These IDs can then be used during a restart to locate the starting position for consumption.
+
+**Troubleshooting and Analysis:**
+When a reader encounters issues, inspecting the list of IDs for messages already consumed can help determine the last position the reader has reached. This aids in troubleshooting and resolving problems.

Review Comment:
   Maybe `hasMessageAvailable` is helpful for this case?



##########
pip/pip-296.md:
##########
@@ -0,0 +1,100 @@
+# Background knowledge
+A consumer is a process that attaches to a topic via a subscription and then receives messages. The reader interface for Pulsar enables applications to manually manage cursors. More knowledge of the Reader and Consumer interface can be found in the [Pulsar Client doc](https://pulsar.apache.org/docs/next/concepts-clients/#reader).
+
+# Motivation
+
+Add the `getLastMessageIds` API for Reader.
+
+It can be used in the following case:
+**Message Tracing and Recovery:**
+In specific scenarios, applications might want to continue consuming from where they left off instead of starting from the beginning. Using the `getLastMessageIds` method, applications can retrieve the list of IDs for the last messages consumed in the previous session. These IDs can then be used during a restart to locate the starting position for consumption.

Review Comment:
   Could you explain how do you use `getLastMessageIds` to get the last messages consumed in the previous session?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] liangyepianzhou merged pull request #21052: [improve][pip] Implement getLastMessageIds API for Reader

Posted by "liangyepianzhou (via GitHub)" <gi...@apache.org>.
liangyepianzhou merged PR #21052:
URL: https://github.com/apache/pulsar/pull/21052


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org