duhenglucky commented on code in PR #50:
URL: https://github.com/apache/rocketmq-flink/pull/50#discussion_r950984137


##########
src/main/java/org/apache/rocketmq/flink/legacy/RocketMQSourceFunction.java:
##########
@@ -357,32 +361,37 @@ private long getMessageQueueOffset(MessageQueue mq) 
throws MQClientException {
         // restoredOffsets(unionOffsetStates) is the restored global union 
state;
         // should only snapshot mqs that actually belong to us
         if (offset == null) {
-            // fetchConsumeOffset from broker
-            offset = consumer.fetchConsumeOffset(mq, false);
-            if (!restored || offset < 0) {
-                String initialOffset =
-                        props.getProperty(
-                                RocketMQConfig.CONSUMER_OFFSET_RESET_TO, 
CONSUMER_OFFSET_LATEST);
-                switch (initialOffset) {
-                    case CONSUMER_OFFSET_EARLIEST:
-                        offset = consumer.minOffset(mq);
-                        break;
-                    case CONSUMER_OFFSET_LATEST:
-                        offset = consumer.maxOffset(mq);
-                        break;
-                    case CONSUMER_OFFSET_TIMESTAMP:
-                        offset =
-                                consumer.searchOffset(
-                                        mq,
-                                        getLong(
-                                                props,
-                                                
RocketMQConfig.CONSUMER_OFFSET_FROM_TIMESTAMP,
-                                                System.currentTimeMillis()));
-                        break;
-                    default:
-                        throw new IllegalArgumentException(
-                                "Unknown value for CONSUMER_OFFSET_RESET_TO.");
+            if (startMessageOffset == 
OPTIONAL_START_MESSAGE_OFFSET.defaultValue()) {

Review Comment:
   Minimize iteration depth



-- 
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]

Reply via email to