提交 99ce40a7 编写于 作者: L lindzh 提交者: dongeforever

[ROCKETMQ-189] Misleading tip on consumeTimestamp and wrong consumeTimestamp...

[ROCKETMQ-189] Misleading tip on consumeTimestamp and wrong consumeTimestamp exception message closes apache/incubator-rocketmq#97
上级 82803889
...@@ -655,12 +655,12 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner { ...@@ -655,12 +655,12 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
null); null);
} }
Date dt = UtilAll.parseDate(this.defaultMQPushConsumer.getConsumeTimestamp(), UtilAll.YYYY_MMDD_HHMMSS); Date dt = UtilAll.parseDate(this.defaultMQPushConsumer.getConsumeTimestamp(), UtilAll.YYYYMMDDHHMMSS);
if (null == dt) { if (null == dt) {
throw new MQClientException( throw new MQClientException(
"consumeTimestamp is invalid, YYYY_MMDD_HHMMSS" "consumeTimestamp is invalid, the valid format is yyyyMMddHHmmss,but received "
+ FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), + this.defaultMQPushConsumer.getConsumeTimestamp()
null); + " " + FAQUrl.suggestTodo(FAQUrl.CLIENT_PARAMETER_CHECK_URL), null);
} }
// allocateMessageQueueStrategy // allocateMessageQueueStrategy
......
...@@ -171,7 +171,7 @@ public class RebalancePushImpl extends RebalanceImpl { ...@@ -171,7 +171,7 @@ public class RebalancePushImpl extends RebalanceImpl {
} else { } else {
try { try {
long timestamp = UtilAll.parseDate(this.defaultMQPushConsumerImpl.getDefaultMQPushConsumer().getConsumeTimestamp(), long timestamp = UtilAll.parseDate(this.defaultMQPushConsumerImpl.getDefaultMQPushConsumer().getConsumeTimestamp(),
UtilAll.YYYY_MMDD_HHMMSS).getTime(); UtilAll.YYYYMMDDHHMMSS).getTime();
result = this.mQClientFactory.getMQAdminImpl().searchOffset(mq, timestamp); result = this.mQClientFactory.getMQAdminImpl().searchOffset(mq, timestamp);
} catch (MQClientException e) { } catch (MQClientException e) {
result = -1; result = -1;
......
...@@ -41,7 +41,7 @@ import org.apache.rocketmq.remoting.common.RemotingHelper; ...@@ -41,7 +41,7 @@ import org.apache.rocketmq.remoting.common.RemotingHelper;
public class UtilAll { public class UtilAll {
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd#HH:mm:ss:SSS"; public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd#HH:mm:ss:SSS";
public static final String YYYY_MMDD_HHMMSS = "yyyyMMddHHmmss"; public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static int getPid() { public static int getPid() {
......
...@@ -31,6 +31,8 @@ public class PushConsumer { ...@@ -31,6 +31,8 @@ public class PushConsumer {
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("CID_JODIE_1"); DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("CID_JODIE_1");
consumer.subscribe("Jodie_topic_1023", "*"); consumer.subscribe("Jodie_topic_1023", "*");
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET); consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
//wrong time format 2017_0422_221800
consumer.setConsumeTimestamp("20170422221800");
consumer.registerMessageListener(new MessageListenerConcurrently() { consumer.registerMessageListener(new MessageListenerConcurrently() {
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册