[
https://issues.apache.org/jira/browse/ROCKETMQ-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16060792#comment-16060792
]
ASF GitHub Bot commented on ROCKETMQ-231:
-----------------------------------------
Github user vongosling commented on a diff in the pull request:
https://github.com/apache/incubator-rocketmq/pull/126#discussion_r123730992
--- Diff:
test/src/test/java/org/apache/rocketmq/test/client/consumer/pull/PullSizeTest.java
---
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.test.client.consumer.pull;
+
+import org.apache.log4j.Logger;
+import org.apache.rocketmq.client.consumer.DefaultMQPullConsumer;
+import org.apache.rocketmq.client.consumer.PullResult;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.client.producer.SendResult;
+import org.apache.rocketmq.client.producer.SendStatus;
+import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.common.message.MessageQueue;
+import org.apache.rocketmq.remoting.common.RemotingHelper;
+import org.apache.rocketmq.test.base.BaseConf;
+import org.apache.rocketmq.test.base.IntegrationTestBase;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.nio.channels.Pipe;
+import java.util.*;
+
+public class PullSizeTest extends BaseConf {
+
+ private static Logger logger = Logger.getLogger(PullSizeTest.class);
+
+ private static final Map<MessageQueue, Long> OFFSE_TABLE = new
HashMap<MessageQueue, Long>();
+
+ public static final String PULL_SIZE_TOPIC = "TopicPullTest";
+
+ public static final String PULL_SIZE_GROUP = "pullSizeTest";
+
+ public boolean send() throws MQClientException, InterruptedException {
+ DefaultMQProducer producer = new
DefaultMQProducer(PULL_SIZE_GROUP);
+ producer.setNamesrvAddr(nsAddr);
+ producer.start();
+ int successCount = 0;
+ for (int i = 0; i < 1000; i++) {
+ try {
+ Message msg = new Message(PULL_SIZE_TOPIC, "TagA",
("RocketMQ pull size test index " +
i).getBytes(RemotingHelper.DEFAULT_CHARSET));
+ SendResult sendResult = producer.send(msg);
+ if (sendResult.getSendStatus().equals(SendStatus.SEND_OK))
{
+ successCount++;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ Thread.sleep(500);
+ }
+ }
+ producer.shutdown();
+ if (successCount > 800) {
--- End diff --
why use this magic number 800 in your if statement
> Pull result size is always less than given size in PullConsumer
> ---------------------------------------------------------------
>
> Key: ROCKETMQ-231
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-231
> Project: Apache RocketMQ
> Issue Type: Bug
> Components: rocketmq-broker
> Affects Versions: 4.0.0-incubating
> Reporter: lindzh
> Assignee: yukon
> Priority: Critical
> Fix For: 4.2.0-incubating
>
>
> When using PullConsumer pull message by default result size is 32,and
> messages is more than 32 in a queue,but broker always returns 31.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)