use of org.apache.rocketmq.common.message.MessageClientExt in project rocketmq by apache.
the class QueryMsgByIdIT method testQueryMsg.
@Test
public void testQueryMsg() {
int msgSize = 20;
producer.send(msgSize);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
consumer.getListener().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
Assert.assertEquals("Not all are consumed", 0, VerifyUtils.verify(producer.getAllMsgBody(), consumer.getListener().getAllMsgBody()));
MessageExt recvMsg = (MessageExt) consumer.getListener().getFirstMsg();
MessageExt queryMsg = null;
try {
TestUtils.waitForMoment(3000);
queryMsg = producer.getProducer().viewMessage(((MessageClientExt) recvMsg).getOffsetMsgId());
} catch (Exception e) {
}
assertThat(queryMsg).isNotNull();
assertThat(new String(queryMsg.getBody())).isEqualTo(new String(recvMsg.getBody()));
}
Aggregations