You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Ceilzcx (via GitHub)" <gi...@apache.org> on 2023/03/08 02:30:24 UTC

[GitHub] [rocketmq] Ceilzcx opened a new pull request, #6278: Issue#6205

Ceilzcx opened a new pull request, #6278:
URL: https://github.com/apache/rocketmq/pull/6278

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   <!--
   If this PR fixes a GitHub issue, please add `fixes #<XXX>` or `closes #<XXX>`. Please refer to the documentation for more information:
   https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
   -->
   
   fix #<6205>
   
   ## Brief changelog
   
   LitePullConsumer support async pull message
   
   ## Verifying this change
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] Ceilzcx commented on pull request #6278: [ISSUE #6205] LitePullConsumer support async pull message

Posted by "Ceilzcx (via GitHub)" <gi...@apache.org>.
Ceilzcx commented on PR #6278:
URL: https://github.com/apache/rocketmq/pull/6278#issuecomment-1459888725

   @drpmma sorry, I clicked review by accident


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] drpmma commented on a diff in pull request #6278: LitePullConsumer support async pull message

Posted by "drpmma (via GitHub)" <gi...@apache.org>.
drpmma commented on code in PR #6278:
URL: https://github.com/apache/rocketmq/pull/6278#discussion_r1129040461


##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:
##########
@@ -1021,16 +1032,154 @@ public MessageQueue getMessageQueue() {
         }
     }
 
+    public void pullMessage(final MessageQueue messageQueue) {

Review Comment:
   Is it possible to abstract a method for the purpose of code reuse rather than duplicating it?
   
   https://github.com/apache/rocketmq/blob/a3228ad2736c0311592b12f994361b06cf4f72a9/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java#L896-L1020



##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:
##########
@@ -131,9 +128,17 @@ private enum SubscriptionType {
 
     private DefaultLitePullConsumer defaultLitePullConsumer;
 
+    private PullMessageQueueService pullMessageQueueService;
+
     private final ConcurrentMap<MessageQueue, PullTaskImpl> taskTable =
         new ConcurrentHashMap<>();
 
+    // Dummy value to associate with an Object in the backing Map
+    private static final Object PRESENT = new Object();
+
+    private final ConcurrentMap<MessageQueue, Object> messageQueueTable =

Review Comment:
   It's quite strange to use Object as the map value. Are you attempting to create a concurrent set? If that is the case, you may use the keySet of a ConcurrentMap instead.



##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:
##########
@@ -450,20 +462,22 @@ public PullAPIWrapper getPullAPIWrapper() {
 
     private void startPullTask(Collection<MessageQueue> mqSet) {
         for (MessageQueue messageQueue : mqSet) {
-            if (!this.taskTable.containsKey(messageQueue)) {
-                PullTaskImpl pullTask = new PullTaskImpl(messageQueue);
-                this.taskTable.put(messageQueue, pullTask);
-                this.scheduledThreadPoolExecutor.schedule(pullTask, 0, TimeUnit.MILLISECONDS);
+            if (!this.messageQueueTable.containsKey(messageQueue)) {
+//                PullTaskImpl pullTask = new PullTaskImpl(messageQueue);

Review Comment:
   It's suggested to remove the comment line.



-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] Ceilzcx commented on pull request #6278: Issue#6205

Posted by "Ceilzcx (via GitHub)" <gi...@apache.org>.
Ceilzcx commented on PR #6278:
URL: https://github.com/apache/rocketmq/pull/6278#issuecomment-1459191811

   I don't know if I'm thinking wrong.
   I refer to push mode for PullMessageService to support async pull message


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] Ceilzcx commented on a diff in pull request #6278: LitePullConsumer support async pull message

Posted by "Ceilzcx (via GitHub)" <gi...@apache.org>.
Ceilzcx commented on code in PR #6278:
URL: https://github.com/apache/rocketmq/pull/6278#discussion_r1129058675


##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:
##########
@@ -1021,16 +1032,154 @@ public MessageQueue getMessageQueue() {
         }
     }
 
+    public void pullMessage(final MessageQueue messageQueue) {

Review Comment:
   Thanks for your reply, I don't have a good idea, my thinking is to add a parameter to judge sync or async, and then if... else handle differently



-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] Ceilzcx closed pull request #6278: [ISSUE #6205] LitePullConsumer support async pull message

Posted by "Ceilzcx (via GitHub)" <gi...@apache.org>.
Ceilzcx closed pull request #6278: [ISSUE #6205] LitePullConsumer support async pull message
URL: https://github.com/apache/rocketmq/pull/6278


-- 
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@rocketmq.apache.org

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