Skip to content

Commit

Permalink
fix: fix the consumer of order and simple param test
Browse files Browse the repository at this point in the history
Signed-off-by: wangxye <[email protected]>
  • Loading branch information
wangxye committed Nov 14, 2023
1 parent 1cda952 commit 115b048
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ private static Collection<Object> waitForMessageConsume(DataCollector<Object> en
// Assertions.fail(
// String.format("More retry messages were consumed than expected (including one original message) Except:%s, Actual:%s, MsgId:%s", consumedTimes, getRepeatedTimes(receivedMessagesCopy, enqueueMessageId),
// enqueueMessageId));
iter.remove();
log.error("More retry messages were consumed than expected, Except:{}, Actual:{}", consumedTimes, getRepeatedTimes(receivedMessagesCopy, enqueueMessageId));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public void testOrder_Send_PushConsumeOrderly() {
Assertions.assertEquals(SEND_NUM, producer.getEnqueueMessages().getDataSize(), "send message failed");
// DataCollector<Object> dequeueMessages = simpleConsumer.getListener().getDequeueMessages();
// dequeueMessages.addData(pushConsumer.getListener().getDequeueMessages());

VerifyUtils.verifyOrderMessage(producer.getEnqueueMessages(), pushConsumer.getListener().getDequeueMessages());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public Boolean call() throws Exception {
return recvMessages.size() == SEND_NUM;
}
});

for (int i = 0; i < SEND_NUM; i++) {
Assertions.assertEquals(i, Integer.parseInt(StandardCharsets.UTF_8.decode(recvMessages.get(i).getBody()).toString()), "recv message failed");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@ public void test_waitAckException_reReceive_ack() {
String topic = getTopic(TopicMessageType.NORMAL.getValue(), methodName);
String groupId = getGroupId(methodName);

SimpleConsumer consumer = ConsumerFactory.getSimpleConsumer(account, topic, groupId, new FilterExpression(tag), Duration.ofSeconds(5));
SimpleConsumer consumer = ConsumerFactory.getSimpleConsumer(account, topic, groupId, new FilterExpression(tag), Duration.ofSeconds(10));
// VerifyUtils.tryReceiveOnce(consumer);
RMQNormalProducer producer = ProducerFactory.getRMQProducer(account, topic);
Assertions.assertNotNull(producer, "Get Producer failed");
Message message = MessageFactory.buildMessage(topic, tag, RandomUtils.getStringByUUID());
producer.send(message);
Assertions.assertEquals(1, producer.getEnqueueMessages().getDataSize(), "send message failed");

try {
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() < startTime + 60000) {
while (System.currentTimeMillis() < startTime + 120000) {
TestUtils.waitForSeconds(1);
List<MessageView> messageViews = consumer.receive(1, Duration.ofSeconds(10));
if (messageViews.size() > 0) {
for (MessageView messageView : messageViews) {
Expand Down

0 comments on commit 115b048

Please sign in to comment.