buptxxb65 commented on code in PR #6417:
URL: https://github.com/apache/rocketmq/pull/6417#discussion_r1142926732
##########
client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:
##########
@@ -860,9 +861,16 @@ public class PullTaskImpl implements Runnable {
private final MessageQueue messageQueue;
private volatile boolean cancelled = false;
private Thread currentThread;
+ private final CommunicationMode communicationMode;
public PullTaskImpl(final MessageQueue messageQueue) {
this.messageQueue = messageQueue;
+ communicationMode = CommunicationMode.SYNC;
+ }
+
+ public PullTaskImpl(final MessageQueue messageQueue, CommunicationMode
communicationMode) {
+ this.messageQueue = messageQueue;
+ this.communicationMode = communicationMode;
Review Comment:
Thanks for your comment! I have the same confusion about the entrance of
asynchronous pullTask.
As you see, I create another constructor here. When user creates the
PullTaskImpl with "Async", the pullTask will run in the asynchronous way.
However, I find that the PullTaskImpl only be created in other methods (e.g.
seek(), startPullTask()) in this class.
If we let user decide which way to pull the tasks, we need to add a new
parameter "communicationMode" for all upstream functions **or** in the class
DefaultLitePullConsumerImpl (maybe better? just a private parameter with a
set() function). I think either of them will make the code more complex.
This is my thought on the entrance design, but as I'm a freshman in
RocketMQ, there may be some areas where I have not considered thoroughly. I
would appreciate your advice and guidance on this.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]